o port NDIS USB support from USB1 to the new usb(USB2).
o implement URB_FUNCTION_ABORT_PIPE handling. o remove unused code related with canceling the timer list for USB drivers. o whitespace cleanup and style(9) Obtained from: hps's original patch
This commit is contained in:
parent
9d875e6973
commit
6affafd098
@ -48,6 +48,7 @@ extern image_patch_table hal_functbl[];
|
||||
__BEGIN_DECLS
|
||||
extern int hal_libinit(void);
|
||||
extern int hal_libfini(void);
|
||||
extern struct mtx *hal_getdisplock(void);
|
||||
extern uint8_t KfAcquireSpinLock(kspin_lock *);
|
||||
extern void KfReleaseSpinLock(kspin_lock *, uint8_t);
|
||||
extern uint8_t KfRaiseIrql(uint8_t);
|
||||
|
@ -65,8 +65,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <net80211/ieee80211_var.h>
|
||||
#include <net80211/ieee80211_ioctl.h>
|
||||
|
||||
#include <legacy/dev/usb/usb.h>
|
||||
#include <legacy/dev/usb/usbdi.h>
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usb_core.h>
|
||||
|
||||
#include <compat/ndis/pe_var.h>
|
||||
#include <compat/ndis/cfg_var.h>
|
||||
@ -322,7 +322,7 @@ ndis_create_sysctls(arg)
|
||||
#else
|
||||
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
|
||||
#endif
|
||||
oidp = e->entry;
|
||||
oidp = e->entry;
|
||||
if (strcasecmp(oidp->oid_name, vals->nc_cfgkey) == 0)
|
||||
break;
|
||||
oidp = NULL;
|
||||
@ -571,7 +571,7 @@ ndis_convert_res(arg)
|
||||
struct resource_list brl_rev;
|
||||
struct resource_list_entry *n;
|
||||
#endif
|
||||
int error = 0;
|
||||
int error = 0;
|
||||
|
||||
sc = arg;
|
||||
block = sc->ndis_block;
|
||||
@ -1231,7 +1231,7 @@ ndis_init_nic(arg)
|
||||
{
|
||||
struct ndis_softc *sc;
|
||||
ndis_miniport_block *block;
|
||||
ndis_init_handler initfunc;
|
||||
ndis_init_handler initfunc;
|
||||
ndis_status status, openstatus = 0;
|
||||
ndis_medium mediumarray[NdisMediumMax];
|
||||
uint32_t chosenmedium, i;
|
||||
@ -1250,8 +1250,8 @@ ndis_init_nic(arg)
|
||||
for (i = 0; i < NdisMediumMax; i++)
|
||||
mediumarray[i] = i;
|
||||
|
||||
status = MSCALL6(initfunc, &openstatus, &chosenmedium,
|
||||
mediumarray, NdisMediumMax, block, block);
|
||||
status = MSCALL6(initfunc, &openstatus, &chosenmedium,
|
||||
mediumarray, NdisMediumMax, block, block);
|
||||
|
||||
/*
|
||||
* If the init fails, blow away the other exported routines
|
||||
@ -1398,7 +1398,7 @@ NdisAddDevice(drv, pdo)
|
||||
|
||||
sc = device_get_softc(pdo->do_devext);
|
||||
|
||||
if (sc->ndis_iftype == PCMCIABus || sc->ndis_iftype == PCIBus) {
|
||||
if (sc->ndis_iftype == PCMCIABus || sc->ndis_iftype == PCIBus) {
|
||||
error = bus_setup_intr(sc->ndis_dev, sc->ndis_irq,
|
||||
INTR_TYPE_NET | INTR_MPSAFE,
|
||||
NULL, ntoskrnl_intr, NULL, &sc->ndis_intrhand);
|
||||
@ -1431,7 +1431,7 @@ NdisAddDevice(drv, pdo)
|
||||
* Stash pointers to the miniport block and miniport
|
||||
* characteristics info in the if_ndis softc so the
|
||||
* UNIX wrapper driver can get to them later.
|
||||
*/
|
||||
*/
|
||||
sc->ndis_block = block;
|
||||
sc->ndis_chars = IoGetDriverObjectExtension(drv, (void *)1);
|
||||
|
||||
|
@ -56,8 +56,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <machine/segments.h>
|
||||
#endif
|
||||
|
||||
#include <legacy/dev/usb/usb.h>
|
||||
#include <legacy/dev/usb/usbdi.h>
|
||||
#include <dev/usb/usb.h>
|
||||
|
||||
#include <compat/ndis/pe_var.h>
|
||||
#include <compat/ndis/cfg_var.h>
|
||||
@ -95,7 +94,7 @@ windrv_libinit(void)
|
||||
{
|
||||
STAILQ_INIT(&drvdb_head);
|
||||
mtx_init(&drvdb_mtx, "Windows driver DB lock",
|
||||
"Windows internal lock", MTX_DEF);
|
||||
"Windows internal lock", MTX_DEF);
|
||||
|
||||
/*
|
||||
* PCI and pccard devices don't need to use IRPs to
|
||||
@ -286,7 +285,7 @@ windrv_unload(mod, img, len)
|
||||
if (drv == NULL)
|
||||
return(ENOENT);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Destroy any custom extensions that may have been added.
|
||||
*/
|
||||
drv = r->windrv_object;
|
||||
@ -341,7 +340,7 @@ windrv_load(mod, img, len, bustype, devlist, regvals)
|
||||
*/
|
||||
|
||||
ptr = (uint32_t *)(img + 8);
|
||||
if (*ptr == WINDRV_LOADED)
|
||||
if (*ptr == WINDRV_LOADED)
|
||||
goto skipreloc;
|
||||
|
||||
/* Perform text relocation */
|
||||
@ -390,7 +389,7 @@ skipreloc:
|
||||
free (new, M_DEVBUF);
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
|
||||
/* Allocate a driver extension structure too. */
|
||||
|
||||
drv->dro_driverext = malloc(sizeof(driver_extension),
|
||||
@ -544,7 +543,7 @@ windrv_bus_attach(drv, name)
|
||||
new->windrv_devlist = NULL;
|
||||
new->windrv_regvals = NULL;
|
||||
|
||||
mtx_lock(&drvdb_mtx);
|
||||
mtx_lock(&drvdb_mtx);
|
||||
STAILQ_INSERT_HEAD(&drvdb_head, new, link);
|
||||
mtx_unlock(&drvdb_mtx);
|
||||
|
||||
@ -727,41 +726,41 @@ static int windrv_wrap_stdcall(funcptr, funcptr *, int);
|
||||
static int windrv_wrap_fastcall(funcptr, funcptr *, int);
|
||||
static int windrv_wrap_regparm(funcptr, funcptr *);
|
||||
|
||||
extern void x86_fastcall_wrap(void);
|
||||
extern void x86_fastcall_wrap_call(void);
|
||||
extern void x86_fastcall_wrap_arg(void);
|
||||
extern void x86_fastcall_wrap_end(void);
|
||||
extern void x86_fastcall_wrap(void);
|
||||
extern void x86_fastcall_wrap_call(void);
|
||||
extern void x86_fastcall_wrap_arg(void);
|
||||
extern void x86_fastcall_wrap_end(void);
|
||||
|
||||
static int
|
||||
windrv_wrap_fastcall(func, wrap, argcnt)
|
||||
funcptr func;
|
||||
funcptr *wrap;
|
||||
funcptr func;
|
||||
funcptr *wrap;
|
||||
int8_t argcnt;
|
||||
{
|
||||
funcptr p;
|
||||
vm_offset_t *calladdr;
|
||||
funcptr p;
|
||||
vm_offset_t *calladdr;
|
||||
uint8_t *argaddr;
|
||||
vm_offset_t wrapstart, wrapend, wrapcall, wraparg;
|
||||
vm_offset_t wrapstart, wrapend, wrapcall, wraparg;
|
||||
|
||||
wrapstart = (vm_offset_t)&x86_fastcall_wrap;
|
||||
wrapend = (vm_offset_t)&x86_fastcall_wrap_end;
|
||||
wrapcall = (vm_offset_t)&x86_fastcall_wrap_call;
|
||||
wraparg = (vm_offset_t)&x86_fastcall_wrap_arg;
|
||||
wrapstart = (vm_offset_t)&x86_fastcall_wrap;
|
||||
wrapend = (vm_offset_t)&x86_fastcall_wrap_end;
|
||||
wrapcall = (vm_offset_t)&x86_fastcall_wrap_call;
|
||||
wraparg = (vm_offset_t)&x86_fastcall_wrap_arg;
|
||||
|
||||
/* Allocate a new wrapper instance. */
|
||||
/* Allocate a new wrapper instance. */
|
||||
|
||||
p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT);
|
||||
if (p == NULL)
|
||||
return(ENOMEM);
|
||||
p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT);
|
||||
if (p == NULL)
|
||||
return(ENOMEM);
|
||||
|
||||
/* Copy over the code. */
|
||||
/* Copy over the code. */
|
||||
|
||||
bcopy((char *)wrapstart, p, (wrapend - wrapstart));
|
||||
|
||||
/* Insert the function address into the new wrapper instance. */
|
||||
/* Insert the function address into the new wrapper instance. */
|
||||
|
||||
calladdr = (vm_offset_t *)((char *)p + ((wrapcall - wrapstart) + 1));
|
||||
*calladdr = (vm_offset_t)func;
|
||||
*calladdr = (vm_offset_t)func;
|
||||
|
||||
argcnt -= 2;
|
||||
if (argcnt < 1)
|
||||
@ -770,96 +769,96 @@ windrv_wrap_fastcall(func, wrap, argcnt)
|
||||
argaddr = (u_int8_t *)((char *)p + ((wraparg - wrapstart) + 1));
|
||||
*argaddr = argcnt * sizeof(uint32_t);
|
||||
|
||||
*wrap = p;
|
||||
*wrap = p;
|
||||
|
||||
return(0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
extern void x86_stdcall_wrap(void);
|
||||
extern void x86_stdcall_wrap_call(void);
|
||||
extern void x86_stdcall_wrap_arg(void);
|
||||
extern void x86_stdcall_wrap_end(void);
|
||||
extern void x86_stdcall_wrap(void);
|
||||
extern void x86_stdcall_wrap_call(void);
|
||||
extern void x86_stdcall_wrap_arg(void);
|
||||
extern void x86_stdcall_wrap_end(void);
|
||||
|
||||
static int
|
||||
windrv_wrap_stdcall(func, wrap, argcnt)
|
||||
funcptr func;
|
||||
funcptr *wrap;
|
||||
funcptr func;
|
||||
funcptr *wrap;
|
||||
uint8_t argcnt;
|
||||
{
|
||||
funcptr p;
|
||||
vm_offset_t *calladdr;
|
||||
funcptr p;
|
||||
vm_offset_t *calladdr;
|
||||
uint8_t *argaddr;
|
||||
vm_offset_t wrapstart, wrapend, wrapcall, wraparg;
|
||||
vm_offset_t wrapstart, wrapend, wrapcall, wraparg;
|
||||
|
||||
wrapstart = (vm_offset_t)&x86_stdcall_wrap;
|
||||
wrapend = (vm_offset_t)&x86_stdcall_wrap_end;
|
||||
wrapcall = (vm_offset_t)&x86_stdcall_wrap_call;
|
||||
wraparg = (vm_offset_t)&x86_stdcall_wrap_arg;
|
||||
wrapstart = (vm_offset_t)&x86_stdcall_wrap;
|
||||
wrapend = (vm_offset_t)&x86_stdcall_wrap_end;
|
||||
wrapcall = (vm_offset_t)&x86_stdcall_wrap_call;
|
||||
wraparg = (vm_offset_t)&x86_stdcall_wrap_arg;
|
||||
|
||||
/* Allocate a new wrapper instance. */
|
||||
/* Allocate a new wrapper instance. */
|
||||
|
||||
p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT);
|
||||
if (p == NULL)
|
||||
return(ENOMEM);
|
||||
p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT);
|
||||
if (p == NULL)
|
||||
return(ENOMEM);
|
||||
|
||||
/* Copy over the code. */
|
||||
/* Copy over the code. */
|
||||
|
||||
bcopy((char *)wrapstart, p, (wrapend - wrapstart));
|
||||
|
||||
/* Insert the function address into the new wrapper instance. */
|
||||
/* Insert the function address into the new wrapper instance. */
|
||||
|
||||
calladdr = (vm_offset_t *)((char *)p + ((wrapcall - wrapstart) + 1));
|
||||
*calladdr = (vm_offset_t)func;
|
||||
*calladdr = (vm_offset_t)func;
|
||||
|
||||
argaddr = (u_int8_t *)((char *)p + ((wraparg - wrapstart) + 1));
|
||||
*argaddr = argcnt * sizeof(uint32_t);
|
||||
|
||||
*wrap = p;
|
||||
*wrap = p;
|
||||
|
||||
return(0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
extern void x86_regparm_wrap(void);
|
||||
extern void x86_regparm_wrap_call(void);
|
||||
extern void x86_regparm_wrap_end(void);
|
||||
extern void x86_regparm_wrap(void);
|
||||
extern void x86_regparm_wrap_call(void);
|
||||
extern void x86_regparm_wrap_end(void);
|
||||
|
||||
static int
|
||||
windrv_wrap_regparm(func, wrap)
|
||||
funcptr func;
|
||||
funcptr *wrap;
|
||||
funcptr func;
|
||||
funcptr *wrap;
|
||||
{
|
||||
funcptr p;
|
||||
vm_offset_t *calladdr;
|
||||
vm_offset_t wrapstart, wrapend, wrapcall;
|
||||
funcptr p;
|
||||
vm_offset_t *calladdr;
|
||||
vm_offset_t wrapstart, wrapend, wrapcall;
|
||||
|
||||
wrapstart = (vm_offset_t)&x86_regparm_wrap;
|
||||
wrapend = (vm_offset_t)&x86_regparm_wrap_end;
|
||||
wrapcall = (vm_offset_t)&x86_regparm_wrap_call;
|
||||
wrapstart = (vm_offset_t)&x86_regparm_wrap;
|
||||
wrapend = (vm_offset_t)&x86_regparm_wrap_end;
|
||||
wrapcall = (vm_offset_t)&x86_regparm_wrap_call;
|
||||
|
||||
/* Allocate a new wrapper instance. */
|
||||
/* Allocate a new wrapper instance. */
|
||||
|
||||
p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT);
|
||||
if (p == NULL)
|
||||
return(ENOMEM);
|
||||
p = malloc((wrapend - wrapstart), M_DEVBUF, M_NOWAIT);
|
||||
if (p == NULL)
|
||||
return(ENOMEM);
|
||||
|
||||
/* Copy over the code. */
|
||||
/* Copy over the code. */
|
||||
|
||||
bcopy(x86_regparm_wrap, p, (wrapend - wrapstart));
|
||||
bcopy(x86_regparm_wrap, p, (wrapend - wrapstart));
|
||||
|
||||
/* Insert the function address into the new wrapper instance. */
|
||||
/* Insert the function address into the new wrapper instance. */
|
||||
|
||||
calladdr = (vm_offset_t *)((char *)p + ((wrapcall - wrapstart) + 1));
|
||||
*calladdr = (vm_offset_t)func;
|
||||
*calladdr = (vm_offset_t)func;
|
||||
|
||||
*wrap = p;
|
||||
*wrap = p;
|
||||
|
||||
return(0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
windrv_wrap(func, wrap, argcnt, ftype)
|
||||
funcptr func;
|
||||
funcptr *wrap;
|
||||
funcptr func;
|
||||
funcptr *wrap;
|
||||
int argcnt;
|
||||
int ftype;
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -33,17 +33,17 @@
|
||||
*/
|
||||
|
||||
#ifndef _PE_VAR_H_
|
||||
#define _PE_VAR_H_
|
||||
#define _PE_VAR_H_
|
||||
|
||||
/*
|
||||
* Image Format
|
||||
*/
|
||||
|
||||
#define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
|
||||
#define IMAGE_OS2_SIGNATURE 0x454E /* NE */
|
||||
#define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
|
||||
#define IMAGE_VXD_SIGNATURE 0x454C /* LE */
|
||||
#define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
|
||||
#define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
|
||||
#define IMAGE_OS2_SIGNATURE 0x454E /* NE */
|
||||
#define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
|
||||
#define IMAGE_VXD_SIGNATURE 0x454C /* LE */
|
||||
#define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
|
||||
|
||||
/*
|
||||
* All PE files have one of these, just so if you attempt to
|
||||
@ -84,7 +84,7 @@ struct image_file_header {
|
||||
uint16_t ifh_numsections; /* # of sections */
|
||||
uint32_t ifh_timestamp; /* Date/time stamp */
|
||||
uint32_t ifh_symtblptr; /* Offset to symbol table */
|
||||
uint32_t ifh_numsyms; /* # of symbols */
|
||||
uint32_t ifh_numsyms; /* # of symbols */
|
||||
uint16_t ifh_optionalhdrlen; /* Size of optional header */
|
||||
uint16_t ifh_characteristics; /* Characteristics */
|
||||
};
|
||||
@ -93,57 +93,57 @@ typedef struct image_file_header image_file_header;
|
||||
|
||||
/* Machine types */
|
||||
|
||||
#define IMAGE_FILE_MACHINE_UNKNOWN 0
|
||||
#define IMAGE_FILE_MACHINE_I860 0x014d
|
||||
#define IMAGE_FILE_MACHINE_I386 0x014c
|
||||
#define IMAGE_FILE_MACHINE_R3000 0x0162
|
||||
#define IMAGE_FILE_MACHINE_R4000 0x0166
|
||||
#define IMAGE_FILE_MACHINE_R10000 0x0168
|
||||
#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
|
||||
#define IMAGE_FILE_MACHINE_ALPHA 0x0184
|
||||
#define IMAGE_FILE_MACHINE_SH3 0x01a2
|
||||
#define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
|
||||
#define IMAGE_FILE_MACHINE_SH3E 0x01a4
|
||||
#define IMAGE_FILE_MACHINE_SH4 0x01a6
|
||||
#define IMAGE_FILE_MACHINE_SH5 0x01a8
|
||||
#define IMAGE_FILE_MACHINE_ARM 0x01c0
|
||||
#define IMAGE_FILE_MACHINE_THUMB 0x01c2
|
||||
#define IMAGE_FILE_MACHINE_AM33 0x01d3
|
||||
#define IMAGE_FILE_MACHINE_POWERPC 0x01f0
|
||||
#define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
|
||||
#define IMAGE_FILE_MACHINE_IA64 0x0200
|
||||
#define IMAGE_FILE_MACHINE_MIPS16 0x0266
|
||||
#define IMAGE_FILE_MACHINE_ALPHA64 0x0284
|
||||
#define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
|
||||
#define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
|
||||
#define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
|
||||
#define IMAGE_FILE_MACHINE_TRICORE 0x0520
|
||||
#define IMAGE_FILE_MACHINE_CEF 0x0cef
|
||||
#define IMAGE_FILE_MACHINE_EBC 0x0ebc
|
||||
#define IMAGE_FILE_MACHINE_AMD64 0x8664
|
||||
#define IMAGE_FILE_MACHINE_M32R 0x9041
|
||||
#define IMAGE_FILE_MACHINE_CEE 0xc0ee
|
||||
#define IMAGE_FILE_MACHINE_UNKNOWN 0
|
||||
#define IMAGE_FILE_MACHINE_I860 0x014d
|
||||
#define IMAGE_FILE_MACHINE_I386 0x014c
|
||||
#define IMAGE_FILE_MACHINE_R3000 0x0162
|
||||
#define IMAGE_FILE_MACHINE_R4000 0x0166
|
||||
#define IMAGE_FILE_MACHINE_R10000 0x0168
|
||||
#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
|
||||
#define IMAGE_FILE_MACHINE_ALPHA 0x0184
|
||||
#define IMAGE_FILE_MACHINE_SH3 0x01a2
|
||||
#define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
|
||||
#define IMAGE_FILE_MACHINE_SH3E 0x01a4
|
||||
#define IMAGE_FILE_MACHINE_SH4 0x01a6
|
||||
#define IMAGE_FILE_MACHINE_SH5 0x01a8
|
||||
#define IMAGE_FILE_MACHINE_ARM 0x01c0
|
||||
#define IMAGE_FILE_MACHINE_THUMB 0x01c2
|
||||
#define IMAGE_FILE_MACHINE_AM33 0x01d3
|
||||
#define IMAGE_FILE_MACHINE_POWERPC 0x01f0
|
||||
#define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
|
||||
#define IMAGE_FILE_MACHINE_IA64 0x0200
|
||||
#define IMAGE_FILE_MACHINE_MIPS16 0x0266
|
||||
#define IMAGE_FILE_MACHINE_ALPHA64 0x0284
|
||||
#define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
|
||||
#define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
|
||||
#define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
|
||||
#define IMAGE_FILE_MACHINE_TRICORE 0x0520
|
||||
#define IMAGE_FILE_MACHINE_CEF 0x0cef
|
||||
#define IMAGE_FILE_MACHINE_EBC 0x0ebc
|
||||
#define IMAGE_FILE_MACHINE_AMD64 0x8664
|
||||
#define IMAGE_FILE_MACHINE_M32R 0x9041
|
||||
#define IMAGE_FILE_MACHINE_CEE 0xc0ee
|
||||
|
||||
/* Characteristics */
|
||||
|
||||
#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
|
||||
#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
|
||||
#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
|
||||
#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
|
||||
#define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
|
||||
#define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
|
||||
#define IMAGE_FILE_16BIT_MACHINE 0x0040
|
||||
#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
|
||||
#define IMAGE_FILE_32BIT_MACHINE 0x0100
|
||||
#define IMAGE_FILE_DEBUG_STRIPPED 0x0200
|
||||
#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
|
||||
#define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
|
||||
#define IMAGE_FILE_SYSTEM 0x1000
|
||||
#define IMAGE_FILE_DLL 0x2000
|
||||
#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
|
||||
#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
|
||||
#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
|
||||
#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
|
||||
#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
|
||||
#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
|
||||
#define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
|
||||
#define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
|
||||
#define IMAGE_FILE_16BIT_MACHINE 0x0040
|
||||
#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
|
||||
#define IMAGE_FILE_32BIT_MACHINE 0x0100
|
||||
#define IMAGE_FILE_DEBUG_STRIPPED 0x0200
|
||||
#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
|
||||
#define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
|
||||
#define IMAGE_FILE_SYSTEM 0x1000
|
||||
#define IMAGE_FILE_DLL 0x2000
|
||||
#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
|
||||
#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
|
||||
|
||||
#define IMAGE_SIZEOF_FILE_HEADER 20
|
||||
#define IMAGE_SIZEOF_FILE_HEADER 20
|
||||
|
||||
/*
|
||||
* Directory format.
|
||||
@ -156,7 +156,7 @@ struct image_data_directory {
|
||||
|
||||
typedef struct image_data_directory image_data_directory;
|
||||
|
||||
#define IMAGE_DIRECTORY_ENTRIES_MAX 16
|
||||
#define IMAGE_DIRECTORY_ENTRIES_MAX 16
|
||||
|
||||
/*
|
||||
* Optional header format.
|
||||
@ -220,50 +220,50 @@ typedef struct image_nt_header image_nt_header;
|
||||
|
||||
/* Directory Entries */
|
||||
|
||||
#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 /* Export Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 /* Import Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 /* Resource Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 /* Exception Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 /* Security Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 /* Base Relocation Table */
|
||||
#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 /* Debug Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 /* Description String */
|
||||
#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* Machine Value (MIPS GP) */
|
||||
#define IMAGE_DIRECTORY_ENTRY_TLS 9 /* TLS Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 /* Load Configuration Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11 /* Bound Import Directory in headers */
|
||||
#define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
|
||||
#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
|
||||
#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
|
||||
#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 /* Export Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 /* Import Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 /* Resource Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 /* Exception Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 /* Security Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 /* Base Relocation Table */
|
||||
#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 /* Debug Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 /* Description String */
|
||||
#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* Machine Value (MIPS GP) */
|
||||
#define IMAGE_DIRECTORY_ENTRY_TLS 9 /* TLS Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 /* Load Configuration Directory */
|
||||
#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11 /* Bound Import Directory in headers */
|
||||
#define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
|
||||
#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
|
||||
#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
|
||||
|
||||
/* Resource types */
|
||||
|
||||
#define RT_CURSOR 1
|
||||
#define RT_BITMAP 2
|
||||
#define RT_ICON 3
|
||||
#define RT_MENU 4
|
||||
#define RT_DIALOG 5
|
||||
#define RT_STRING 6
|
||||
#define RT_FONTDIR 7
|
||||
#define RT_FONT 8
|
||||
#define RT_ACCELERATOR 9
|
||||
#define RT_RCDATA 10
|
||||
#define RT_MESSAGETABLE 11
|
||||
#define RT_GROUP_CURSOR 12
|
||||
#define RT_GROUP_ICON 14
|
||||
#define RT_VERSION 16
|
||||
#define RT_DLGINCLUDE 17
|
||||
#define RT_PLUGPLAY 19
|
||||
#define RT_VXD 20
|
||||
#define RT_ANICURSOR 21
|
||||
#define RT_ANIICON 22
|
||||
#define RT_HTML 23
|
||||
#define RT_CURSOR 1
|
||||
#define RT_BITMAP 2
|
||||
#define RT_ICON 3
|
||||
#define RT_MENU 4
|
||||
#define RT_DIALOG 5
|
||||
#define RT_STRING 6
|
||||
#define RT_FONTDIR 7
|
||||
#define RT_FONT 8
|
||||
#define RT_ACCELERATOR 9
|
||||
#define RT_RCDATA 10
|
||||
#define RT_MESSAGETABLE 11
|
||||
#define RT_GROUP_CURSOR 12
|
||||
#define RT_GROUP_ICON 14
|
||||
#define RT_VERSION 16
|
||||
#define RT_DLGINCLUDE 17
|
||||
#define RT_PLUGPLAY 19
|
||||
#define RT_VXD 20
|
||||
#define RT_ANICURSOR 21
|
||||
#define RT_ANIICON 22
|
||||
#define RT_HTML 23
|
||||
|
||||
/*
|
||||
* Section header format.
|
||||
*/
|
||||
|
||||
#define IMAGE_SHORT_NAME_LEN 8
|
||||
#define IMAGE_SHORT_NAME_LEN 8
|
||||
|
||||
struct image_section_header {
|
||||
uint8_t ish_name[IMAGE_SHORT_NAME_LEN];
|
||||
@ -283,9 +283,9 @@ struct image_section_header {
|
||||
|
||||
typedef struct image_section_header image_section_header;
|
||||
|
||||
#define IMAGE_SIZEOF_SECTION_HEADER 40
|
||||
#define IMAGE_SIZEOF_SECTION_HEADER 40
|
||||
|
||||
#define IMAGE_FIRST_SECTION(nthdr) \
|
||||
#define IMAGE_FIRST_SECTION(nthdr) \
|
||||
((image_section_header *)((vm_offset_t)(nthdr) + \
|
||||
offsetof(image_nt_header, inh_optionalhdr) + \
|
||||
((image_nt_header *)(nthdr))->inh_filehdr.ifh_optionalhdrlen))
|
||||
@ -299,8 +299,8 @@ struct image_import_by_name {
|
||||
uint8_t iibn_name[1];
|
||||
};
|
||||
|
||||
#define IMAGE_ORDINAL_FLAG 0x80000000
|
||||
#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
|
||||
#define IMAGE_ORDINAL_FLAG 0x80000000
|
||||
#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
|
||||
|
||||
struct image_import_descriptor {
|
||||
uint32_t iid_import_name_table_addr;
|
||||
@ -320,22 +320,22 @@ struct image_base_reloc {
|
||||
|
||||
typedef struct image_base_reloc image_base_reloc;
|
||||
|
||||
#define IMR_RELTYPE(x) ((x >> 12) & 0xF)
|
||||
#define IMR_RELOFFSET(x) (x & 0xFFF)
|
||||
#define IMR_RELTYPE(x) ((x >> 12) & 0xF)
|
||||
#define IMR_RELOFFSET(x) (x & 0xFFF)
|
||||
|
||||
/* generic relocation types */
|
||||
#define IMAGE_REL_BASED_ABSOLUTE 0
|
||||
#define IMAGE_REL_BASED_HIGH 1
|
||||
#define IMAGE_REL_BASED_LOW 2
|
||||
#define IMAGE_REL_BASED_HIGHLOW 3
|
||||
#define IMAGE_REL_BASED_HIGHADJ 4
|
||||
#define IMAGE_REL_BASED_MIPS_JMPADDR 5
|
||||
#define IMAGE_REL_BASED_SECTION 6
|
||||
#define IMAGE_REL_BASED_REL 7
|
||||
#define IMAGE_REL_BASED_MIPS_JMPADDR16 9
|
||||
#define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
|
||||
#define IMAGE_REL_BASED_DIR64 10
|
||||
#define IMAGE_REL_BASED_HIGH3ADJ 11
|
||||
#define IMAGE_REL_BASED_ABSOLUTE 0
|
||||
#define IMAGE_REL_BASED_HIGH 1
|
||||
#define IMAGE_REL_BASED_LOW 2
|
||||
#define IMAGE_REL_BASED_HIGHLOW 3
|
||||
#define IMAGE_REL_BASED_HIGHADJ 4
|
||||
#define IMAGE_REL_BASED_MIPS_JMPADDR 5
|
||||
#define IMAGE_REL_BASED_SECTION 6
|
||||
#define IMAGE_REL_BASED_REL 7
|
||||
#define IMAGE_REL_BASED_MIPS_JMPADDR16 9
|
||||
#define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
|
||||
#define IMAGE_REL_BASED_DIR64 10
|
||||
#define IMAGE_REL_BASED_HIGH3ADJ 11
|
||||
|
||||
struct image_resource_directory_entry {
|
||||
uint32_t irde_name;
|
||||
@ -344,8 +344,8 @@ struct image_resource_directory_entry {
|
||||
|
||||
typedef struct image_resource_directory_entry image_resource_directory_entry;
|
||||
|
||||
#define RESOURCE_NAME_STR 0x80000000
|
||||
#define RESOURCE_DIR_FLAG 0x80000000
|
||||
#define RESOURCE_NAME_STR 0x80000000
|
||||
#define RESOURCE_DIR_FLAG 0x80000000
|
||||
|
||||
struct image_resource_directory {
|
||||
uint32_t ird_characteristics;
|
||||
@ -410,7 +410,7 @@ struct message_resource_entry {
|
||||
|
||||
typedef struct message_resource_entry message_resource_entry;
|
||||
|
||||
#define MESSAGE_RESOURCE_UNICODE 0x0001
|
||||
#define MESSAGE_RESOURCE_UNICODE 0x0001
|
||||
|
||||
struct image_patch_table {
|
||||
char *ipt_name;
|
||||
@ -461,20 +461,20 @@ extern uint64_t x86_64_call6(void *, uint64_t, uint64_t, uint64_t, uint64_t,
|
||||
uint64_t, uint64_t);
|
||||
|
||||
|
||||
#define MSCALL1(fn, a) \
|
||||
#define MSCALL1(fn, a) \
|
||||
x86_64_call1((fn), (uint64_t)(a))
|
||||
#define MSCALL2(fn, a, b) \
|
||||
#define MSCALL2(fn, a, b) \
|
||||
x86_64_call2((fn), (uint64_t)(a), (uint64_t)(b))
|
||||
#define MSCALL3(fn, a, b, c) \
|
||||
#define MSCALL3(fn, a, b, c) \
|
||||
x86_64_call3((fn), (uint64_t)(a), (uint64_t)(b), \
|
||||
(uint64_t)(c))
|
||||
#define MSCALL4(fn, a, b, c, d) \
|
||||
#define MSCALL4(fn, a, b, c, d) \
|
||||
x86_64_call4((fn), (uint64_t)(a), (uint64_t)(b), \
|
||||
(uint64_t)(c), (uint64_t)(d))
|
||||
#define MSCALL5(fn, a, b, c, d, e) \
|
||||
#define MSCALL5(fn, a, b, c, d, e) \
|
||||
x86_64_call5((fn), (uint64_t)(a), (uint64_t)(b), \
|
||||
(uint64_t)(c), (uint64_t)(d), (uint64_t)(e))
|
||||
#define MSCALL6(fn, a, b, c, d, e, f) \
|
||||
#define MSCALL6(fn, a, b, c, d, e, f) \
|
||||
x86_64_call6((fn), (uint64_t)(a), (uint64_t)(b), \
|
||||
(uint64_t)(c), (uint64_t)(d), (uint64_t)(e), (uint64_t)(f))
|
||||
|
||||
@ -484,47 +484,47 @@ extern uint64_t x86_64_call6(void *, uint64_t, uint64_t, uint64_t, uint64_t,
|
||||
|
||||
extern uint32_t x86_stdcall_call(void *, int, ...);
|
||||
|
||||
#define MSCALL1(fn, a) x86_stdcall_call(fn, 1, (a))
|
||||
#define MSCALL2(fn, a, b) x86_stdcall_call(fn, 2, (a), (b))
|
||||
#define MSCALL3(fn, a, b, c) x86_stdcall_call(fn, 3, (a), (b), (c))
|
||||
#define MSCALL4(fn, a, b, c, d) x86_stdcall_call(fn, 4, (a), (b), (c), (d))
|
||||
#define MSCALL5(fn, a, b, c, d, e) \
|
||||
#define MSCALL1(fn, a) x86_stdcall_call(fn, 1, (a))
|
||||
#define MSCALL2(fn, a, b) x86_stdcall_call(fn, 2, (a), (b))
|
||||
#define MSCALL3(fn, a, b, c) x86_stdcall_call(fn, 3, (a), (b), (c))
|
||||
#define MSCALL4(fn, a, b, c, d) x86_stdcall_call(fn, 4, (a), (b), (c), (d))
|
||||
#define MSCALL5(fn, a, b, c, d, e) \
|
||||
x86_stdcall_call(fn, 5, (a), (b), (c), (d), (e))
|
||||
#define MSCALL6(fn, a, b, c, d, e, f) \
|
||||
#define MSCALL6(fn, a, b, c, d, e, f) \
|
||||
x86_stdcall_call(fn, 6, (a), (b), (c), (d), (e), (f))
|
||||
|
||||
#endif /* __i386__ */
|
||||
|
||||
|
||||
#define FUNC void(*)(void)
|
||||
#define FUNC void(*)(void)
|
||||
|
||||
#ifdef __i386__
|
||||
#define IMPORT_SFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_STDCALL }
|
||||
#define IMPORT_SFUNC_MAP(x, y, z) \
|
||||
#define IMPORT_SFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_STDCALL }
|
||||
#define IMPORT_SFUNC_MAP(x, y, z) \
|
||||
{ #x, (FUNC)y, NULL, z, WINDRV_WRAP_STDCALL }
|
||||
#define IMPORT_FFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_FASTCALL }
|
||||
#define IMPORT_FFUNC_MAP(x, y, z) \
|
||||
#define IMPORT_FFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_FASTCALL }
|
||||
#define IMPORT_FFUNC_MAP(x, y, z) \
|
||||
{ #x, (FUNC)y, NULL, z, WINDRV_WRAP_FASTCALL }
|
||||
#define IMPORT_RFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_REGPARM }
|
||||
#define IMPORT_RFUNC_MAP(x, y, z) \
|
||||
#define IMPORT_RFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_REGPARM }
|
||||
#define IMPORT_RFUNC_MAP(x, y, z) \
|
||||
{ #x, (FUNC)y, NULL, z, WINDRV_WRAP_REGPARM }
|
||||
#define IMPORT_CFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_CDECL }
|
||||
#define IMPORT_CFUNC_MAP(x, y, z) \
|
||||
#define IMPORT_CFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_CDECL }
|
||||
#define IMPORT_CFUNC_MAP(x, y, z) \
|
||||
{ #x, (FUNC)y, NULL, z, WINDRV_WRAP_CDECL }
|
||||
#endif /* __i386__ */
|
||||
|
||||
#ifdef __amd64__
|
||||
#define IMPORT_SFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_AMD64 }
|
||||
#define IMPORT_SFUNC_MAP(x, y, z) \
|
||||
#define IMPORT_SFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_AMD64 }
|
||||
#define IMPORT_SFUNC_MAP(x, y, z) \
|
||||
{ #x, (FUNC)y, NULL, z, WINDRV_WRAP_AMD64 }
|
||||
#define IMPORT_FFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_AMD64 }
|
||||
#define IMPORT_FFUNC_MAP(x, y, z) \
|
||||
#define IMPORT_FFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_AMD64 }
|
||||
#define IMPORT_FFUNC_MAP(x, y, z) \
|
||||
{ #x, (FUNC)y, NULL, z, WINDRV_WRAP_AMD64 }
|
||||
#define IMPORT_RFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_AMD64 }
|
||||
#define IMPORT_RFUNC_MAP(x, y, z) \
|
||||
#define IMPORT_RFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_AMD64 }
|
||||
#define IMPORT_RFUNC_MAP(x, y, z) \
|
||||
{ #x, (FUNC)y, NULL, z, WINDRV_WRAP_AMD64 }
|
||||
#define IMPORT_CFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_AMD64 }
|
||||
#define IMPORT_CFUNC_MAP(x, y, z) \
|
||||
#define IMPORT_CFUNC(x, y) { #x, (FUNC)x, NULL, y, WINDRV_WRAP_AMD64 }
|
||||
#define IMPORT_CFUNC_MAP(x, y, z) \
|
||||
{ #x, (FUNC)y, NULL, z, WINDRV_WRAP_AMD64 }
|
||||
#endif /* __amd64__ */
|
||||
|
||||
|
@ -33,55 +33,55 @@
|
||||
*/
|
||||
|
||||
#ifndef _RESOURCE_VAR_H_
|
||||
#define _RESOURCE_VAR_H_
|
||||
#define _RESOURCE_VAR_H_
|
||||
|
||||
typedef int cm_resource_type;
|
||||
|
||||
struct physaddr {
|
||||
uint64_t np_quad;
|
||||
uint64_t np_quad;
|
||||
#ifdef notdef
|
||||
uint32_t np_low;
|
||||
uint32_t np_high;
|
||||
uint32_t np_low;
|
||||
uint32_t np_high;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct physaddr physaddr;
|
||||
|
||||
enum interface_type {
|
||||
InterfaceTypeUndefined = -1,
|
||||
Internal,
|
||||
Isa,
|
||||
Eisa,
|
||||
MicroChannel,
|
||||
TurboChannel,
|
||||
PCIBus,
|
||||
VMEBus,
|
||||
NuBus,
|
||||
PCMCIABus,
|
||||
CBus,
|
||||
MPIBus,
|
||||
MPSABus,
|
||||
ProcessorInternal,
|
||||
InternalPowerBus,
|
||||
PNPISABus,
|
||||
PNPBus,
|
||||
MaximumInterfaceType
|
||||
InterfaceTypeUndefined = -1,
|
||||
Internal,
|
||||
Isa,
|
||||
Eisa,
|
||||
MicroChannel,
|
||||
TurboChannel,
|
||||
PCIBus,
|
||||
VMEBus,
|
||||
NuBus,
|
||||
PCMCIABus,
|
||||
CBus,
|
||||
MPIBus,
|
||||
MPSABus,
|
||||
ProcessorInternal,
|
||||
InternalPowerBus,
|
||||
PNPISABus,
|
||||
PNPBus,
|
||||
MaximumInterfaceType
|
||||
};
|
||||
|
||||
typedef enum interface_type interface_type;
|
||||
|
||||
#define CmResourceTypeNull 0 /* ResType_All or ResType_None (0x0000) */
|
||||
#define CmResourceTypePort 1 /* ResType_IO (0x0002) */
|
||||
#define CmResourceTypeInterrupt 2 /* ResType_IRQ (0x0004) */
|
||||
#define CmResourceTypeMemory 3 /* ResType_Mem (0x0001) */
|
||||
#define CmResourceTypeDma 4 /* ResType_DMA (0x0003) */
|
||||
#define CmResourceTypeDeviceSpecific 5 /* ResType_ClassSpecific (0xFFFF) */
|
||||
#define CmResourceTypeBusNumber 6 /* ResType_BusNumber (0x0006) */
|
||||
#define CmResourceTypeMaximum 7
|
||||
#define CmResourceTypeNonArbitrated 128 /* Not arbitrated if 0x80 bit set */
|
||||
#define CmResourceTypeConfigData 128 /* ResType_Reserved (0x8000) */
|
||||
#define CmResourceTypeDevicePrivate 129 /* ResType_DevicePrivate (0x8001) */
|
||||
#define CmResourceTypePcCardConfig 130 /* ResType_PcCardConfig (0x8002) */
|
||||
#define CmResourceTypeNull 0 /* ResType_All or ResType_None (0x0000) */
|
||||
#define CmResourceTypePort 1 /* ResType_IO (0x0002) */
|
||||
#define CmResourceTypeInterrupt 2 /* ResType_IRQ (0x0004) */
|
||||
#define CmResourceTypeMemory 3 /* ResType_Mem (0x0001) */
|
||||
#define CmResourceTypeDma 4 /* ResType_DMA (0x0003) */
|
||||
#define CmResourceTypeDeviceSpecific 5 /* ResType_ClassSpecific (0xFFFF) */
|
||||
#define CmResourceTypeBusNumber 6 /* ResType_BusNumber (0x0006) */
|
||||
#define CmResourceTypeMaximum 7
|
||||
#define CmResourceTypeNonArbitrated 128 /* Not arbitrated if 0x80 bit set */
|
||||
#define CmResourceTypeConfigData 128 /* ResType_Reserved (0x8000) */
|
||||
#define CmResourceTypeDevicePrivate 129 /* ResType_DevicePrivate (0x8001) */
|
||||
#define CmResourceTypePcCardConfig 130 /* ResType_PcCardConfig (0x8002) */
|
||||
|
||||
enum cm_share_disposition {
|
||||
CmResourceShareUndetermined = 0, /* Reserved */
|
||||
@ -94,41 +94,41 @@ typedef enum cm_share_disposition cm_share_disposition;
|
||||
|
||||
/* Define the bit masks for Flags when type is CmResourceTypeInterrupt */
|
||||
|
||||
#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0
|
||||
#define CM_RESOURCE_INTERRUPT_LATCHED 1
|
||||
#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0
|
||||
#define CM_RESOURCE_INTERRUPT_LATCHED 1
|
||||
|
||||
/* Define the bit masks for Flags when type is CmResourceTypeMemory */
|
||||
|
||||
#define CM_RESOURCE_MEMORY_READ_WRITE 0x0000
|
||||
#define CM_RESOURCE_MEMORY_READ_ONLY 0x0001
|
||||
#define CM_RESOURCE_MEMORY_WRITE_ONLY 0x0002
|
||||
#define CM_RESOURCE_MEMORY_PREFETCHABLE 0x0004
|
||||
#define CM_RESOURCE_MEMORY_READ_WRITE 0x0000
|
||||
#define CM_RESOURCE_MEMORY_READ_ONLY 0x0001
|
||||
#define CM_RESOURCE_MEMORY_WRITE_ONLY 0x0002
|
||||
#define CM_RESOURCE_MEMORY_PREFETCHABLE 0x0004
|
||||
|
||||
#define CM_RESOURCE_MEMORY_COMBINEDWRITE 0x0008
|
||||
#define CM_RESOURCE_MEMORY_24 0x0010
|
||||
#define CM_RESOURCE_MEMORY_CACHEABLE 0x0020
|
||||
#define CM_RESOURCE_MEMORY_COMBINEDWRITE 0x0008
|
||||
#define CM_RESOURCE_MEMORY_24 0x0010
|
||||
#define CM_RESOURCE_MEMORY_CACHEABLE 0x0020
|
||||
|
||||
/* Define the bit masks for Flags when type is CmResourceTypePort */
|
||||
|
||||
#define CM_RESOURCE_PORT_MEMORY 0x0000
|
||||
#define CM_RESOURCE_PORT_IO 0x0001
|
||||
#define CM_RESOURCE_PORT_10_BIT_DECODE 0x0004
|
||||
#define CM_RESOURCE_PORT_12_BIT_DECODE 0x0008
|
||||
#define CM_RESOURCE_PORT_16_BIT_DECODE 0x0010
|
||||
#define CM_RESOURCE_PORT_POSITIVE_DECODE 0x0020
|
||||
#define CM_RESOURCE_PORT_PASSIVE_DECODE 0x0040
|
||||
#define CM_RESOURCE_PORT_WINDOW_DECODE 0x0080
|
||||
#define CM_RESOURCE_PORT_MEMORY 0x0000
|
||||
#define CM_RESOURCE_PORT_IO 0x0001
|
||||
#define CM_RESOURCE_PORT_10_BIT_DECODE 0x0004
|
||||
#define CM_RESOURCE_PORT_12_BIT_DECODE 0x0008
|
||||
#define CM_RESOURCE_PORT_16_BIT_DECODE 0x0010
|
||||
#define CM_RESOURCE_PORT_POSITIVE_DECODE 0x0020
|
||||
#define CM_RESOURCE_PORT_PASSIVE_DECODE 0x0040
|
||||
#define CM_RESOURCE_PORT_WINDOW_DECODE 0x0080
|
||||
|
||||
/* Define the bit masks for Flags when type is CmResourceTypeDma */
|
||||
|
||||
#define CM_RESOURCE_DMA_8 0x0000
|
||||
#define CM_RESOURCE_DMA_16 0x0001
|
||||
#define CM_RESOURCE_DMA_32 0x0002
|
||||
#define CM_RESOURCE_DMA_8_AND_16 0x0004
|
||||
#define CM_RESOURCE_DMA_BUS_MASTER 0x0008
|
||||
#define CM_RESOURCE_DMA_TYPE_A 0x0010
|
||||
#define CM_RESOURCE_DMA_TYPE_B 0x0020
|
||||
#define CM_RESOURCE_DMA_TYPE_F 0x0040
|
||||
#define CM_RESOURCE_DMA_8 0x0000
|
||||
#define CM_RESOURCE_DMA_16 0x0001
|
||||
#define CM_RESOURCE_DMA_32 0x0002
|
||||
#define CM_RESOURCE_DMA_8_AND_16 0x0004
|
||||
#define CM_RESOURCE_DMA_BUS_MASTER 0x0008
|
||||
#define CM_RESOURCE_DMA_TYPE_A 0x0010
|
||||
#define CM_RESOURCE_DMA_TYPE_B 0x0020
|
||||
#define CM_RESOURCE_DMA_TYPE_F 0x0040
|
||||
|
||||
struct cm_partial_resource_desc {
|
||||
uint8_t cprd_type;
|
||||
|
@ -102,7 +102,7 @@ hal_libinit()
|
||||
patch++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -124,6 +124,13 @@ hal_libfini()
|
||||
return(0);
|
||||
}
|
||||
|
||||
struct mtx *
|
||||
hal_getdisplock()
|
||||
{
|
||||
|
||||
return &disp_lock[curthread->td_oncpu];
|
||||
}
|
||||
|
||||
static void
|
||||
KeStallExecutionProcessor(usecs)
|
||||
uint32_t usecs;
|
||||
@ -420,7 +427,7 @@ KfRaiseIrql(uint8_t irql)
|
||||
return(oldirql);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
KfLowerIrql(uint8_t oldirql)
|
||||
{
|
||||
if (oldirql == DISPATCH_LEVEL)
|
||||
|
@ -95,8 +95,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <legacy/dev/usb/usb.h>
|
||||
#include <legacy/dev/usb/usbdi.h>
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usb_core.h>
|
||||
|
||||
#include <compat/ndis/pe_var.h>
|
||||
#include <compat/ndis/cfg_var.h>
|
||||
@ -116,7 +116,7 @@ __FBSDID("$FreeBSD$");
|
||||
static char ndis_filepath[MAXPATHLEN];
|
||||
|
||||
SYSCTL_STRING(_hw, OID_AUTO, ndis_filepath, CTLFLAG_RW, ndis_filepath,
|
||||
MAXPATHLEN, "Path used by NdisOpenFile() to search for files");
|
||||
MAXPATHLEN, "Path used by NdisOpenFile() to search for files");
|
||||
|
||||
static void NdisInitializeWrapper(ndis_handle *,
|
||||
driver_object *, void *, void *);
|
||||
@ -276,7 +276,7 @@ static void NdisCloseFile(ndis_handle);
|
||||
static uint8_t NdisSystemProcessorCount(void);
|
||||
static void NdisMIndicateStatusComplete(ndis_handle);
|
||||
static void NdisMIndicateStatus(ndis_handle, ndis_status,
|
||||
void *, uint32_t);
|
||||
void *, uint32_t);
|
||||
static uint8_t ndis_intr(kinterrupt *, void *);
|
||||
static void ndis_intrhand(kdpc *, ndis_miniport_interrupt *, void *, void *);
|
||||
static funcptr ndis_findwrap(funcptr);
|
||||
@ -304,15 +304,6 @@ static void dummy(void);
|
||||
*/
|
||||
#define NDIS_POOL_EXTRA 16
|
||||
|
||||
struct ktimer_list {
|
||||
ktimer *kl_timer;
|
||||
list_entry kl_next;
|
||||
};
|
||||
|
||||
static struct list_entry ndis_timerlist;
|
||||
static kspin_lock ndis_timerlock;
|
||||
static int ndis_isusbdev;
|
||||
|
||||
int
|
||||
ndis_libinit()
|
||||
{
|
||||
@ -328,9 +319,6 @@ ndis_libinit()
|
||||
patch++;
|
||||
}
|
||||
|
||||
KeInitializeSpinLock(&ndis_timerlock);
|
||||
InitializeListHead(&ndis_timerlist);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -562,7 +550,7 @@ NdisOpenConfigurationKeyByIndex(status, cfg, idx, subkey, subhandle)
|
||||
static ndis_status
|
||||
ndis_encode_parm(block, oid, type, parm)
|
||||
ndis_miniport_block *block;
|
||||
struct sysctl_oid *oid;
|
||||
struct sysctl_oid *oid;
|
||||
ndis_parm_type type;
|
||||
ndis_config_parm **parm;
|
||||
{
|
||||
@ -639,7 +627,7 @@ NdisReadConfiguration(status, parm, cfg, key, type)
|
||||
char *keystr = NULL;
|
||||
ndis_miniport_block *block;
|
||||
struct ndis_softc *sc;
|
||||
struct sysctl_oid *oidp;
|
||||
struct sysctl_oid *oidp;
|
||||
struct sysctl_ctx_entry *e;
|
||||
ansi_string as;
|
||||
|
||||
@ -747,7 +735,7 @@ NdisWriteConfiguration(status, cfg, key, parm)
|
||||
char *keystr = NULL;
|
||||
ndis_miniport_block *block;
|
||||
struct ndis_softc *sc;
|
||||
struct sysctl_oid *oidp;
|
||||
struct sysctl_oid *oidp;
|
||||
struct sysctl_ctx_entry *e;
|
||||
char val[256];
|
||||
|
||||
@ -806,8 +794,8 @@ NdisCloseConfiguration(cfg)
|
||||
block = (ndis_miniport_block *)cfg;
|
||||
|
||||
while (!IsListEmpty(&block->nmb_parmlist)) {
|
||||
e = RemoveHeadList(&block->nmb_parmlist);
|
||||
pe = CONTAINING_RECORD(e, ndis_parmlist_entry, np_list);
|
||||
e = RemoveHeadList(&block->nmb_parmlist);
|
||||
pe = CONTAINING_RECORD(e, ndis_parmlist_entry, np_list);
|
||||
p = &pe->np_parm;
|
||||
if (p->ncp_type == ndis_parm_string)
|
||||
RtlFreeUnicodeString(&p->ncp_parmdata.ncp_stringdata);
|
||||
@ -1224,14 +1212,10 @@ NdisMInitializeTimer(timer, handle, func, ctx)
|
||||
void *ctx;
|
||||
{
|
||||
ndis_miniport_block *block;
|
||||
struct ktimer_list *kl;
|
||||
struct ndis_softc *sc;
|
||||
uint8_t irql;
|
||||
|
||||
block = (ndis_miniport_block *)handle;
|
||||
sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
|
||||
if (sc->ndis_iftype == PNPBus && ndis_isusbdev == 0)
|
||||
ndis_isusbdev = 1;
|
||||
|
||||
/* Save the driver's funcptr and context */
|
||||
|
||||
@ -1249,39 +1233,6 @@ NdisMInitializeTimer(timer, handle, func, ctx)
|
||||
KeInitializeDpc(&timer->nmt_kdpc,
|
||||
ndis_findwrap((funcptr)ndis_timercall), timer);
|
||||
timer->nmt_ktimer.k_dpc = &timer->nmt_kdpc;
|
||||
|
||||
if (ndis_isusbdev == 1) {
|
||||
kl = (struct ktimer_list *)malloc(sizeof(*kl), M_DEVBUF,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (kl == NULL)
|
||||
panic("out of memory"); /* no way to report errors */
|
||||
|
||||
kl->kl_timer = &timer->nmt_ktimer;
|
||||
KeAcquireSpinLock(&ndis_timerlock, &irql);
|
||||
InsertHeadList((&ndis_timerlist), (&kl->kl_next));
|
||||
KeReleaseSpinLock(&ndis_timerlock, irql);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ndis_cancel_timerlist(void)
|
||||
{
|
||||
list_entry *l;
|
||||
struct ktimer_list *kl;
|
||||
uint8_t cancelled, irql;
|
||||
|
||||
KeAcquireSpinLock(&ndis_timerlock, &irql);
|
||||
|
||||
while(!IsListEmpty(&ndis_timerlist)) {
|
||||
l = RemoveHeadList(&ndis_timerlist);
|
||||
kl = CONTAINING_RECORD(l, struct ktimer_list, kl_next);
|
||||
KeReleaseSpinLock(&ndis_timerlock, irql);
|
||||
cancelled = KeCancelTimer(kl->kl_timer);
|
||||
free(kl, M_DEVBUF);
|
||||
KeAcquireSpinLock(&ndis_timerlock, &irql);
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&ndis_timerlock, irql);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1326,25 +1277,6 @@ NdisMCancelTimer(timer, cancelled)
|
||||
ndis_timer *timer;
|
||||
uint8_t *cancelled;
|
||||
{
|
||||
list_entry *l;
|
||||
struct ktimer_list *kl;
|
||||
uint8_t irql;
|
||||
|
||||
if (ndis_isusbdev == 1) {
|
||||
KeAcquireSpinLock(&ndis_timerlock, &irql);
|
||||
l = ndis_timerlist.nle_flink;
|
||||
while(l != &ndis_timerlist) {
|
||||
kl = CONTAINING_RECORD(l, struct ktimer_list, kl_next);
|
||||
if (kl->kl_timer == &timer->nt_ktimer) {
|
||||
RemoveEntryList((&kl->kl_next));
|
||||
l = l->nle_flink;
|
||||
free(kl, M_DEVBUF);
|
||||
continue;
|
||||
}
|
||||
l = l->nle_flink;
|
||||
}
|
||||
KeReleaseSpinLock(&ndis_timerlock, irql);
|
||||
}
|
||||
|
||||
*cancelled = KeCancelTimer(&timer->nt_ktimer);
|
||||
return;
|
||||
@ -1726,7 +1658,7 @@ NdisMFreeSharedMemory(ndis_handle adapter, uint32_t len, uint8_t cached,
|
||||
if (sh->ndis_saddr == vaddr)
|
||||
break;
|
||||
/*
|
||||
* Check the physaddr too, just in case the driver lied
|
||||
* Check the physaddr too, just in case the driver lied
|
||||
* about the virtual address.
|
||||
*/
|
||||
if (sh->ndis_paddr.np_quad == paddr.np_quad)
|
||||
@ -1874,7 +1806,7 @@ NdisAllocatePacketPool(status, pool, descnum, protrsvdlen)
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
p->np_dead = 0;
|
||||
KeInitializeSpinLock(&p->np_lock);
|
||||
KeInitializeEvent(&p->np_event, EVENT_TYPE_NOTIFY, TRUE);
|
||||
KeInitializeEvent(&p->np_event, EVENT_TYPE_NOTIFY, TRUE);
|
||||
#endif
|
||||
|
||||
*pool = p;
|
||||
@ -1910,19 +1842,19 @@ NdisFreePacketPool(pool)
|
||||
{
|
||||
ndis_packet_pool *p;
|
||||
int usage;
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
uint8_t irql;
|
||||
#endif
|
||||
|
||||
p = (ndis_packet_pool *)pool;
|
||||
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
KeAcquireSpinLock(&p->np_lock, &irql);
|
||||
#endif
|
||||
|
||||
usage = NdisPacketPoolUsage(pool);
|
||||
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
if (usage) {
|
||||
p->np_dead = 1;
|
||||
KeResetEvent(&p->np_event);
|
||||
@ -1946,13 +1878,13 @@ NdisAllocatePacket(status, packet, pool)
|
||||
{
|
||||
ndis_packet_pool *p;
|
||||
ndis_packet *pkt;
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
uint8_t irql;
|
||||
#endif
|
||||
|
||||
p = (ndis_packet_pool *)pool;
|
||||
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
KeAcquireSpinLock(&p->np_lock, &irql);
|
||||
if (p->np_dead) {
|
||||
KeReleaseSpinLock(&p->np_lock, irql);
|
||||
@ -1965,7 +1897,7 @@ NdisAllocatePacket(status, packet, pool)
|
||||
|
||||
pkt = (ndis_packet *)InterlockedPopEntrySList(&p->np_head);
|
||||
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
KeReleaseSpinLock(&p->np_lock, irql);
|
||||
#endif
|
||||
|
||||
@ -1987,7 +1919,7 @@ NdisAllocatePacket(status, packet, pool)
|
||||
* We must initialize the packet flags correctly in order
|
||||
* for the NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO() and
|
||||
* NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO() macros to work
|
||||
* correctly.
|
||||
* correctly.
|
||||
*/
|
||||
pkt->np_private.npp_ndispktflags = NDIS_PACKET_ALLOCATED_BY_NDIS;
|
||||
pkt->np_private.npp_validcounts = FALSE;
|
||||
@ -2004,19 +1936,19 @@ NdisFreePacket(packet)
|
||||
ndis_packet *packet;
|
||||
{
|
||||
ndis_packet_pool *p;
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
uint8_t irql;
|
||||
#endif
|
||||
|
||||
p = (ndis_packet_pool *)packet->np_private.npp_pool;
|
||||
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
KeAcquireSpinLock(&p->np_lock, &irql);
|
||||
#endif
|
||||
|
||||
InterlockedPushEntrySList(&p->np_head, (slist_entry *)packet);
|
||||
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
#ifdef NDIS_DEBUG_PACKETS
|
||||
if (p->np_dead) {
|
||||
if (ExQueryDepthSList(&p->np_head) == p->np_cnt)
|
||||
KeSetEvent(&p->np_event, IO_NO_INCREMENT, FALSE);
|
||||
@ -2339,7 +2271,7 @@ NdisMPciAssignResources(adapter, slot, list)
|
||||
static uint8_t
|
||||
ndis_intr(iobj, arg)
|
||||
kinterrupt *iobj;
|
||||
void *arg;
|
||||
void *arg;
|
||||
{
|
||||
struct ndis_softc *sc;
|
||||
uint8_t is_our_intr = FALSE;
|
||||
@ -2376,24 +2308,24 @@ ndis_intrhand(dpc, intr, sysarg1, sysarg2)
|
||||
{
|
||||
struct ndis_softc *sc;
|
||||
ndis_miniport_block *block;
|
||||
ndis_handle adapter;
|
||||
ndis_handle adapter;
|
||||
|
||||
block = intr->ni_block;
|
||||
adapter = block->nmb_miniportadapterctx;
|
||||
adapter = block->nmb_miniportadapterctx;
|
||||
sc = device_get_softc(block->nmb_physdeviceobj->do_devext);
|
||||
|
||||
if (NDIS_SERIALIZED(sc->ndis_block))
|
||||
KeAcquireSpinLockAtDpcLevel(&block->nmb_lock);
|
||||
if (NDIS_SERIALIZED(sc->ndis_block))
|
||||
KeAcquireSpinLockAtDpcLevel(&block->nmb_lock);
|
||||
|
||||
MSCALL1(intr->ni_dpcfunc, adapter);
|
||||
MSCALL1(intr->ni_dpcfunc, adapter);
|
||||
|
||||
/* If there's a MiniportEnableInterrupt() routine, call it. */
|
||||
/* If there's a MiniportEnableInterrupt() routine, call it. */
|
||||
|
||||
if (sc->ndis_chars->nmc_enable_interrupts_func != NULL)
|
||||
MSCALL1(sc->ndis_chars->nmc_enable_interrupts_func, adapter);
|
||||
|
||||
if (NDIS_SERIALIZED(sc->ndis_block))
|
||||
KeReleaseSpinLockFromDpcLevel(&block->nmb_lock);
|
||||
if (NDIS_SERIALIZED(sc->ndis_block))
|
||||
KeReleaseSpinLockFromDpcLevel(&block->nmb_lock);
|
||||
|
||||
/*
|
||||
* Set the completion event if we've drained all
|
||||
@ -2406,7 +2338,7 @@ ndis_intrhand(dpc, intr, sysarg1, sysarg2)
|
||||
KeSetEvent(&intr->ni_dpcevt, IO_NO_INCREMENT, FALSE);
|
||||
KeReleaseSpinLockFromDpcLevel(&intr->ni_dpccountlock);
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
static ndis_status
|
||||
@ -2436,10 +2368,10 @@ NdisMRegisterInterrupt(ndis_miniport_interrupt *intr, ndis_handle adapter,
|
||||
intr->ni_isrfunc = ch->nmc_isr_func;
|
||||
intr->ni_dpcfunc = ch->nmc_interrupt_func;
|
||||
|
||||
KeInitializeEvent(&intr->ni_dpcevt, EVENT_TYPE_NOTIFY, TRUE);
|
||||
KeInitializeDpc(&intr->ni_dpc,
|
||||
KeInitializeEvent(&intr->ni_dpcevt, EVENT_TYPE_NOTIFY, TRUE);
|
||||
KeInitializeDpc(&intr->ni_dpc,
|
||||
ndis_findwrap((funcptr)ndis_intrhand), intr);
|
||||
KeSetImportanceDpc(&intr->ni_dpc, KDPC_IMPORTANCE_LOW);
|
||||
KeSetImportanceDpc(&intr->ni_dpc, KDPC_IMPORTANCE_LOW);
|
||||
|
||||
error = IoConnectInterrupt(&intr->ni_introbj,
|
||||
ndis_findwrap((funcptr)ndis_intr), sc, NULL,
|
||||
@ -2451,7 +2383,7 @@ NdisMRegisterInterrupt(ndis_miniport_interrupt *intr, ndis_handle adapter,
|
||||
block->nmb_interrupt = intr;
|
||||
|
||||
return(NDIS_STATUS_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
NdisMDeregisterInterrupt(intr)
|
||||
@ -2729,7 +2661,7 @@ NdisGetSystemUpTime(tval)
|
||||
uint32_t *tval;
|
||||
{
|
||||
struct timespec ts;
|
||||
|
||||
|
||||
nanouptime(&ts);
|
||||
*tval = ts.tv_nsec / 1000000 + ts.tv_sec * 1000;
|
||||
|
||||
@ -3160,7 +3092,7 @@ NdisSystemProcessorCount()
|
||||
|
||||
typedef void (*ndis_statusdone_handler)(ndis_handle);
|
||||
typedef void (*ndis_status_handler)(ndis_handle, ndis_status,
|
||||
void *, uint32_t);
|
||||
void *, uint32_t);
|
||||
|
||||
static void
|
||||
NdisMIndicateStatusComplete(adapter)
|
||||
@ -3434,8 +3366,8 @@ image_patch_table ndis_functbl[] = {
|
||||
IMPORT_SFUNC(NdisOpenConfigurationKeyByName, 4),
|
||||
IMPORT_SFUNC(NdisOpenConfigurationKeyByIndex, 5),
|
||||
IMPORT_SFUNC(NdisMRemoveMiniport, 1),
|
||||
IMPORT_SFUNC(NdisInitializeString, 2),
|
||||
IMPORT_SFUNC(NdisFreeString, 1),
|
||||
IMPORT_SFUNC(NdisInitializeString, 2),
|
||||
IMPORT_SFUNC(NdisFreeString, 1),
|
||||
IMPORT_SFUNC(NdisGetCurrentSystemTime, 1),
|
||||
IMPORT_SFUNC(NdisGetSystemUpTime, 1),
|
||||
IMPORT_SFUNC(NdisMSynchronizeWithInterrupt, 3),
|
||||
|
@ -315,9 +315,9 @@ ntoskrnl_libinit()
|
||||
*/
|
||||
|
||||
#ifdef NTOSKRNL_MULTIPLE_DPCS
|
||||
for (i = 0; i < mp_ncpus; i++) {
|
||||
for (i = 0; i < mp_ncpus; i++) {
|
||||
#else
|
||||
for (i = 0; i < 1; i++) {
|
||||
for (i = 0; i < 1; i++) {
|
||||
#endif
|
||||
kq = kq_queues + i;
|
||||
kq->kq_cpu = i;
|
||||
@ -326,17 +326,17 @@ ntoskrnl_libinit()
|
||||
RFHIGHPID, NDIS_KSTACK_PAGES, name);
|
||||
if (error)
|
||||
panic("failed to launch DPC thread");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Launch the workitem threads.
|
||||
*/
|
||||
|
||||
for (i = 0; i < WORKITEM_THREADS; i++) {
|
||||
for (i = 0; i < WORKITEM_THREADS; i++) {
|
||||
kq = wq_queues + i;
|
||||
sprintf(name, "Windows Workitem %d", i);
|
||||
error = kproc_create(ntoskrnl_workitem_thread, kq, &p,
|
||||
RFHIGHPID, NDIS_KSTACK_PAGES, name);
|
||||
RFHIGHPID, NDIS_KSTACK_PAGES, name);
|
||||
if (error)
|
||||
panic("failed to launch workitem thread");
|
||||
}
|
||||
@ -498,8 +498,8 @@ ntoskrnl_strncat(dst, src, n)
|
||||
d++;
|
||||
} while (--n != 0);
|
||||
*d = 0;
|
||||
}
|
||||
return (dst);
|
||||
}
|
||||
return (dst);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -516,7 +516,7 @@ ntoskrnl_tolower(c)
|
||||
return(tolower(c));
|
||||
}
|
||||
|
||||
static uint8_t
|
||||
static uint8_t
|
||||
RtlEqualUnicodeString(unicode_string *str1, unicode_string *str2,
|
||||
uint8_t caseinsensitive)
|
||||
{
|
||||
@ -931,7 +931,7 @@ IoBuildAsynchronousFsdRequest(func, dobj, buf, len, off, status)
|
||||
sl->isl_parameters.isl_write.isl_byteoff = *off;
|
||||
else
|
||||
sl->isl_parameters.isl_write.isl_byteoff = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return(ip);
|
||||
}
|
||||
@ -1281,7 +1281,7 @@ KeSynchronizeExecution(iobj, syncfunc, syncctx)
|
||||
void *syncctx;
|
||||
{
|
||||
uint8_t irql;
|
||||
|
||||
|
||||
KeAcquireSpinLock(&ntoskrnl_intlock, &irql);
|
||||
MSCALL1(syncfunc, syncctx);
|
||||
KeReleaseSpinLock(&ntoskrnl_intlock, irql);
|
||||
@ -1415,7 +1415,7 @@ ntoskrnl_is_signalled(obj, td)
|
||||
struct thread *td;
|
||||
{
|
||||
kmutant *km;
|
||||
|
||||
|
||||
if (obj->dh_type == DISP_TYPE_MUTANT) {
|
||||
km = (kmutant *)obj;
|
||||
if ((obj->dh_sigstate <= 0 && km->km_ownerthread == td) ||
|
||||
@ -1812,11 +1812,11 @@ KeWaitForMultipleObjects(uint32_t cnt, nt_dispatch_header *obj[], uint32_t wtype
|
||||
wcnt++;
|
||||
if (ntoskrnl_is_signalled(obj[i], td)) {
|
||||
/*
|
||||
* There's a limit to how many times
|
||||
* we can recursively acquire a mutant.
|
||||
* If we hit the limit, something
|
||||
* There's a limit to how many times
|
||||
* we can recursively acquire a mutant.
|
||||
* If we hit the limit, something
|
||||
* is very wrong.
|
||||
*/
|
||||
*/
|
||||
if (obj[i]->dh_sigstate == INT32_MIN &&
|
||||
obj[i]->dh_type == DISP_TYPE_MUTANT) {
|
||||
mtx_unlock(&ntoskrnl_dispatchlock);
|
||||
@ -1861,7 +1861,7 @@ KeWaitForMultipleObjects(uint32_t cnt, nt_dispatch_header *obj[], uint32_t wtype
|
||||
|
||||
(w - 1)->wb_next = whead;
|
||||
|
||||
/* Wait on any objects that aren't yet signalled. */
|
||||
/* Wait on any objects that aren't yet signalled. */
|
||||
|
||||
/* Calculate timeout, if any. */
|
||||
|
||||
@ -2334,15 +2334,15 @@ KefReleaseSpinLockFromDpcLevel(lock)
|
||||
uint8_t
|
||||
KeAcquireSpinLockRaiseToDpc(kspin_lock *lock)
|
||||
{
|
||||
uint8_t oldirql;
|
||||
uint8_t oldirql;
|
||||
|
||||
if (KeGetCurrentIrql() > DISPATCH_LEVEL)
|
||||
panic("IRQL_NOT_LESS_THAN_OR_EQUAL");
|
||||
if (KeGetCurrentIrql() > DISPATCH_LEVEL)
|
||||
panic("IRQL_NOT_LESS_THAN_OR_EQUAL");
|
||||
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &oldirql);
|
||||
KeAcquireSpinLockAtDpcLevel(lock);
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &oldirql);
|
||||
KeAcquireSpinLockAtDpcLevel(lock);
|
||||
|
||||
return(oldirql);
|
||||
return(oldirql);
|
||||
}
|
||||
#else
|
||||
void
|
||||
@ -2464,7 +2464,7 @@ IoFreeMdl(m)
|
||||
else
|
||||
ExFreePool(m);
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
static void *
|
||||
@ -2520,7 +2520,7 @@ MmSizeOfMdl(vaddr, len)
|
||||
{
|
||||
uint32_t l;
|
||||
|
||||
l = sizeof(struct mdl) +
|
||||
l = sizeof(struct mdl) +
|
||||
(sizeof(vm_offset_t *) * SPAN_PAGES(vaddr, len));
|
||||
|
||||
return(l);
|
||||
@ -2706,7 +2706,7 @@ ntoskrnl_finddev(dev, paddr, res)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Won't somebody please think of the children! */
|
||||
|
||||
if (children != NULL)
|
||||
@ -2764,10 +2764,10 @@ ntoskrnl_workitem_thread(arg)
|
||||
}
|
||||
|
||||
#if __FreeBSD_version < 502113
|
||||
mtx_lock(&Giant);
|
||||
mtx_lock(&Giant);
|
||||
#endif
|
||||
kproc_exit(0);
|
||||
return; /* notreached */
|
||||
kproc_exit(0);
|
||||
return; /* notreached */
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2779,7 +2779,7 @@ ntoskrnl_destroy_workitem_threads(void)
|
||||
for (i = 0; i < WORKITEM_THREADS; i++) {
|
||||
kq = wq_queues + i;
|
||||
kq->kq_exit = 1;
|
||||
KeSetEvent(&kq->kq_proc, IO_NO_INCREMENT, FALSE);
|
||||
KeSetEvent(&kq->kq_proc, IO_NO_INCREMENT, FALSE);
|
||||
while (kq->kq_exit)
|
||||
tsleep(kq->kq_td->td_proc, PWAIT, "waitiw", hz/10);
|
||||
}
|
||||
@ -3636,9 +3636,9 @@ sysctl_show_timers(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = 0;
|
||||
ret = 0;
|
||||
ntoskrnl_show_timers();
|
||||
return (sysctl_handle_int(oidp, &ret, 0, req));
|
||||
return (sysctl_handle_int(oidp, &ret, 0, req));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3803,9 +3803,9 @@ ntoskrnl_dpc_thread(arg)
|
||||
sched_bind(curthread, kq->kq_cpu);
|
||||
#endif
|
||||
#endif
|
||||
sched_prio(curthread, PRI_MIN_KERN);
|
||||
sched_prio(curthread, PRI_MIN_KERN);
|
||||
#if __FreeBSD_version < 600000
|
||||
curthread->td_base_pri = PRI_MIN_KERN;
|
||||
curthread->td_base_pri = PRI_MIN_KERN;
|
||||
#endif
|
||||
thread_unlock(curthread);
|
||||
|
||||
@ -3840,10 +3840,10 @@ ntoskrnl_dpc_thread(arg)
|
||||
}
|
||||
|
||||
#if __FreeBSD_version < 502113
|
||||
mtx_lock(&Giant);
|
||||
mtx_lock(&Giant);
|
||||
#endif
|
||||
kproc_exit(0);
|
||||
return; /* notreached */
|
||||
kproc_exit(0);
|
||||
return; /* notreached */
|
||||
}
|
||||
|
||||
static void
|
||||
@ -4320,7 +4320,7 @@ image_patch_table ntoskrnl_functbl[] = {
|
||||
IMPORT_FFUNC(InterlockedPushEntrySList, 2),
|
||||
IMPORT_SFUNC(ExQueryDepthSList, 1),
|
||||
IMPORT_FFUNC_MAP(ExpInterlockedPopEntrySList,
|
||||
InterlockedPopEntrySList, 1),
|
||||
InterlockedPopEntrySList, 1),
|
||||
IMPORT_FFUNC_MAP(ExpInterlockedPushEntrySList,
|
||||
InterlockedPushEntrySList, 2),
|
||||
IMPORT_FFUNC(ExInterlockedPopEntrySList, 2),
|
||||
|
@ -417,7 +417,7 @@ pe_relocate(imgbase)
|
||||
relhdr->ibr_vaddr + IMR_RELOFFSET(rel));
|
||||
*qloc = pe_translate_addr(imgbase,
|
||||
(*qloc - base));
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf ("[%d]reloc type: %d\n",i,
|
||||
@ -446,7 +446,7 @@ pe_get_import_descriptor(imgbase, desc, module)
|
||||
vm_offset_t imgbase;
|
||||
image_import_descriptor *desc;
|
||||
char *module;
|
||||
{
|
||||
{
|
||||
vm_offset_t offset;
|
||||
image_import_descriptor *imp_desc;
|
||||
char *modname;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -38,6 +38,7 @@
|
||||
#define IOCTL_INTERNAL_USB_SUBMIT_URB 0x00220003
|
||||
|
||||
#define URB_FUNCTION_SELECT_CONFIGURATION 0x0000
|
||||
#define URB_FUNCTION_ABORT_PIPE 0x0002
|
||||
#define URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER 0x0009
|
||||
#define URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE 0x000B
|
||||
#define URB_FUNCTION_VENDOR_DEVICE 0x0017
|
||||
@ -119,15 +120,20 @@ struct usbd_interface_information {
|
||||
|
||||
struct usbd_urb_select_interface {
|
||||
struct usbd_urb_header usi_hdr;
|
||||
void *usi_handle;
|
||||
struct usbd_interface_information uusi_intf;
|
||||
void *usi_handle;
|
||||
struct usbd_interface_information uusi_intf;
|
||||
};
|
||||
|
||||
struct usbd_urb_select_configuration {
|
||||
struct usbd_urb_header usc_hdr;
|
||||
usb_config_descriptor_t *usc_conf;
|
||||
void *usc_handle;
|
||||
struct usbd_interface_information usc_intf;
|
||||
usb_config_descriptor_t *usc_conf;
|
||||
void *usc_handle;
|
||||
struct usbd_interface_information usc_intf;
|
||||
};
|
||||
|
||||
struct usbd_urb_pipe_request {
|
||||
struct usbd_urb_header upr_hdr;
|
||||
usb_endpoint_descriptor_t *upr_handle;
|
||||
};
|
||||
|
||||
struct usbd_hcd_area {
|
||||
@ -136,47 +142,47 @@ struct usbd_hcd_area {
|
||||
|
||||
struct usbd_urb_bulk_or_intr_transfer {
|
||||
struct usbd_urb_header ubi_hdr;
|
||||
usb_endpoint_descriptor_t *ubi_epdesc;
|
||||
uint32_t ubi_trans_flags;
|
||||
usb_endpoint_descriptor_t *ubi_epdesc;
|
||||
uint32_t ubi_trans_flags;
|
||||
#define USBD_SHORT_TRANSFER_OK 0x00000002
|
||||
uint32_t ubi_trans_buflen;
|
||||
void *ubi_trans_buf;
|
||||
struct mdl *ubi_mdl;
|
||||
union usbd_urb *ubi_urblink;
|
||||
struct usbd_hcd_area ubi_hca;
|
||||
uint32_t ubi_trans_buflen;
|
||||
void *ubi_trans_buf;
|
||||
struct mdl *ubi_mdl;
|
||||
union usbd_urb *ubi_urblink;
|
||||
struct usbd_hcd_area ubi_hca;
|
||||
};
|
||||
|
||||
struct usbd_urb_control_descriptor_request {
|
||||
struct usbd_urb_header ucd_hdr;
|
||||
void *ucd_reserved0;
|
||||
uint32_t ucd_reserved1;
|
||||
uint32_t ucd_trans_buflen;
|
||||
void *ucd_trans_buf;
|
||||
struct mdl *ucd_mdl;
|
||||
union nt_urb *ucd_urblink;
|
||||
struct usbd_hcd_area ucd_hca;
|
||||
uint16_t ucd_reserved2;
|
||||
uint8_t ucd_idx;
|
||||
uint8_t ucd_desctype;
|
||||
uint16_t ucd_langid;
|
||||
uint16_t ucd_reserved3;
|
||||
void *ucd_reserved0;
|
||||
uint32_t ucd_reserved1;
|
||||
uint32_t ucd_trans_buflen;
|
||||
void *ucd_trans_buf;
|
||||
struct mdl *ucd_mdl;
|
||||
union nt_urb *ucd_urblink;
|
||||
struct usbd_hcd_area ucd_hca;
|
||||
uint16_t ucd_reserved2;
|
||||
uint8_t ucd_idx;
|
||||
uint8_t ucd_desctype;
|
||||
uint16_t ucd_langid;
|
||||
uint16_t ucd_reserved3;
|
||||
};
|
||||
|
||||
struct usbd_urb_vendor_or_class_request {
|
||||
struct usbd_urb_header uvc_hdr;
|
||||
void *uvc_reserved0;
|
||||
uint32_t uvc_trans_flags;
|
||||
void *uvc_reserved0;
|
||||
uint32_t uvc_trans_flags;
|
||||
#define USBD_TRANSFER_DIRECTION_IN 1
|
||||
uint32_t uvc_trans_buflen;
|
||||
void *uvc_trans_buf;
|
||||
struct mdl *uvc_mdl;
|
||||
union nt_urb *uvc_urblink;
|
||||
uint32_t uvc_trans_buflen;
|
||||
void *uvc_trans_buf;
|
||||
struct mdl *uvc_mdl;
|
||||
union nt_urb *uvc_urblink;
|
||||
struct usbd_hcd_area uvc_hca;
|
||||
uint8_t uvc_reserved1;
|
||||
uint8_t uvc_req;
|
||||
uint16_t uvc_value;
|
||||
uint16_t uvc_idx;
|
||||
uint16_t uvc_reserved2;
|
||||
uint8_t uvc_reserved1;
|
||||
uint8_t uvc_req;
|
||||
uint16_t uvc_value;
|
||||
uint16_t uvc_idx;
|
||||
uint16_t uvc_reserved2;
|
||||
};
|
||||
|
||||
struct usbd_interface_list_entry {
|
||||
@ -186,10 +192,11 @@ struct usbd_interface_list_entry {
|
||||
|
||||
union usbd_urb {
|
||||
struct usbd_urb_header uu_hdr;
|
||||
struct usbd_urb_select_configuration uu_selconf;
|
||||
struct usbd_urb_bulk_or_intr_transfer uu_bulkintr;
|
||||
struct usbd_urb_control_descriptor_request uu_ctldesc;
|
||||
struct usbd_urb_vendor_or_class_request uu_vcreq;
|
||||
struct usbd_urb_select_configuration uu_selconf;
|
||||
struct usbd_urb_bulk_or_intr_transfer uu_bulkintr;
|
||||
struct usbd_urb_control_descriptor_request uu_ctldesc;
|
||||
struct usbd_urb_vendor_or_class_request uu_vcreq;
|
||||
struct usbd_urb_pipe_request uu_pipe;
|
||||
};
|
||||
|
||||
#define USBD_URB_STATUS(urb) ((urb)->uu_hdr.uuh_status)
|
||||
@ -205,13 +212,6 @@ struct usbd_version_info {
|
||||
|
||||
typedef struct usbd_version_info usbd_version_info;
|
||||
|
||||
/* used for IRP cancel. */
|
||||
struct ndisusb_cancel {
|
||||
device_t dev;
|
||||
usbd_xfer_handle xfer;
|
||||
struct usb_task task;
|
||||
};
|
||||
|
||||
extern image_patch_table usbd_functbl[];
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
@ -74,8 +74,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <legacy/dev/usb/usb.h>
|
||||
#include <legacy/dev/usb/usbdi.h>
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usb_core.h>
|
||||
|
||||
#include <compat/ndis/pe_var.h>
|
||||
#include <compat/ndis/cfg_var.h>
|
||||
@ -557,9 +557,9 @@ ndis_attach(dev)
|
||||
mtx_init(&sc->ndis_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
|
||||
MTX_DEF);
|
||||
KeInitializeSpinLock(&sc->ndis_rxlock);
|
||||
KeInitializeSpinLock(&sc->ndisusb_xferlock);
|
||||
KeInitializeSpinLock(&sc->ndisusb_xferdonelock);
|
||||
InitializeListHead(&sc->ndis_shlist);
|
||||
InitializeListHead(&sc->ndisusb_xferlist);
|
||||
InitializeListHead(&sc->ndisusb_xferdonelist);
|
||||
callout_init(&sc->ndis_stat_callout, CALLOUT_MPSAFE);
|
||||
|
||||
if (sc->ndis_iftype == PCMCIABus) {
|
||||
@ -623,7 +623,8 @@ ndis_attach(dev)
|
||||
sc->ndis_startitem = IoAllocateWorkItem(sc->ndis_block->nmb_deviceobj);
|
||||
sc->ndis_resetitem = IoAllocateWorkItem(sc->ndis_block->nmb_deviceobj);
|
||||
sc->ndis_inputitem = IoAllocateWorkItem(sc->ndis_block->nmb_deviceobj);
|
||||
sc->ndisusb_xferitem = IoAllocateWorkItem(sc->ndis_block->nmb_deviceobj);
|
||||
sc->ndisusb_xferdoneitem =
|
||||
IoAllocateWorkItem(sc->ndis_block->nmb_deviceobj);
|
||||
KeInitializeDpc(&sc->ndis_rxdpc, ndis_rxeof_xfr_wrap, sc->ndis_block);
|
||||
|
||||
/* Call driver's init routine. */
|
||||
@ -718,8 +719,6 @@ ndis_attach(dev)
|
||||
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
|
||||
ifp->if_mtu = ETHERMTU;
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
if (sc->ndis_iftype == PNPBus)
|
||||
ifp->if_flags |= IFF_NEEDSGIANT;
|
||||
ifp->if_ioctl = ndis_ioctl;
|
||||
ifp->if_start = ndis_start;
|
||||
ifp->if_init = ndis_init;
|
||||
@ -966,8 +965,10 @@ fail:
|
||||
if (sc->ndis_iftype == PNPBus && ndisusb_halt == 0)
|
||||
return (error);
|
||||
|
||||
DPRINTF(("attach done.\n"));
|
||||
/* We're done talking to the NIC for now; halt it. */
|
||||
ndis_halt_nic(sc);
|
||||
DPRINTF(("halting done.\n"));
|
||||
|
||||
return(error);
|
||||
}
|
||||
@ -1058,8 +1059,8 @@ ndis_detach(dev)
|
||||
IoFreeWorkItem(sc->ndis_resetitem);
|
||||
if (sc->ndis_inputitem != NULL)
|
||||
IoFreeWorkItem(sc->ndis_inputitem);
|
||||
if (sc->ndisusb_xferitem != NULL)
|
||||
IoFreeWorkItem(sc->ndisusb_xferitem);
|
||||
if (sc->ndisusb_xferdoneitem != NULL)
|
||||
IoFreeWorkItem(sc->ndisusb_xferdoneitem);
|
||||
|
||||
bus_generic_detach(dev);
|
||||
ndis_unload_driver(sc);
|
||||
@ -1569,7 +1570,7 @@ ndis_txeof(adapter, packet, status)
|
||||
ndis_free_packet(packet);
|
||||
m_freem(m);
|
||||
|
||||
NDISMTX_LOCK(sc);
|
||||
NDIS_LOCK(sc);
|
||||
sc->ndis_txarray[idx] = NULL;
|
||||
sc->ndis_txpending++;
|
||||
|
||||
@ -1581,7 +1582,7 @@ ndis_txeof(adapter, packet, status)
|
||||
sc->ndis_tx_timer = 0;
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
|
||||
NDISMTX_UNLOCK(sc);
|
||||
NDIS_UNLOCK(sc);
|
||||
|
||||
IoQueueWorkItem(sc->ndis_startitem,
|
||||
(io_workitem_func)ndis_starttask_wrap,
|
||||
@ -1606,9 +1607,9 @@ ndis_linksts(adapter, status, sbuf, slen)
|
||||
|
||||
/* Event list is all full up, drop this one. */
|
||||
|
||||
NDISMTX_LOCK(sc);
|
||||
NDIS_LOCK(sc);
|
||||
if (sc->ndis_evt[sc->ndis_evtpidx].ne_sts) {
|
||||
NDISMTX_UNLOCK(sc);
|
||||
NDIS_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1618,7 +1619,7 @@ ndis_linksts(adapter, status, sbuf, slen)
|
||||
sc->ndis_evt[sc->ndis_evtpidx].ne_buf = malloc(slen,
|
||||
M_TEMP, M_NOWAIT);
|
||||
if (sc->ndis_evt[sc->ndis_evtpidx].ne_buf == NULL) {
|
||||
NDISMTX_UNLOCK(sc);
|
||||
NDIS_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
bcopy((char *)sbuf,
|
||||
@ -1627,7 +1628,7 @@ ndis_linksts(adapter, status, sbuf, slen)
|
||||
sc->ndis_evt[sc->ndis_evtpidx].ne_sts = status;
|
||||
sc->ndis_evt[sc->ndis_evtpidx].ne_len = slen;
|
||||
NDIS_EVTINC(sc->ndis_evtpidx);
|
||||
NDISMTX_UNLOCK(sc);
|
||||
NDIS_UNLOCK(sc);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -51,10 +51,10 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <net80211/ieee80211_var.h>
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usb_core.h>
|
||||
|
||||
#include <legacy/dev/usb/usb.h>
|
||||
#include <legacy/dev/usb/usbdi.h>
|
||||
#include <net80211/ieee80211_var.h>
|
||||
|
||||
#include <compat/ndis/pe_var.h>
|
||||
#include <compat/ndis/cfg_var.h>
|
||||
|
@ -54,8 +54,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <legacy/dev/usb/usb.h>
|
||||
#include <legacy/dev/usb/usbdi.h>
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usb_core.h>
|
||||
|
||||
#include <compat/ndis/pe_var.h>
|
||||
#include <compat/ndis/cfg_var.h>
|
||||
|
@ -52,11 +52,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <legacy/dev/usb/usb.h>
|
||||
#include <legacy/dev/usb/usbdi.h>
|
||||
#include <legacy/dev/usb/usbdi_util.h>
|
||||
#include <legacy/dev/usb/usbdivar.h>
|
||||
#include "usbdevs.h"
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usb_core.h>
|
||||
|
||||
#include <net80211/ieee80211_var.h>
|
||||
|
||||
@ -114,7 +111,7 @@ DRIVER_MODULE(ndis, uhub, ndis_driver, ndis_devclass, ndisdrv_modevent, 0);
|
||||
static int
|
||||
ndisusb_devcompare(interface_type bustype, struct ndis_usb_type *t, device_t dev)
|
||||
{
|
||||
struct usb_attach_arg *uaa;
|
||||
struct usb2_attach_arg *uaa;
|
||||
|
||||
if (bustype != PNPBus)
|
||||
return (FALSE);
|
||||
@ -122,8 +119,8 @@ ndisusb_devcompare(interface_type bustype, struct ndis_usb_type *t, device_t dev
|
||||
uaa = device_get_ivars(dev);
|
||||
|
||||
while (t->ndis_name != NULL) {
|
||||
if ((uaa->vendor == t->ndis_vid) &&
|
||||
(uaa->product == t->ndis_did)) {
|
||||
if ((uaa->info.idVendor == t->ndis_vid) &&
|
||||
(uaa->info.idProduct == t->ndis_did)) {
|
||||
device_set_desc(dev, t->ndis_name);
|
||||
return (TRUE);
|
||||
}
|
||||
@ -137,65 +134,57 @@ static int
|
||||
ndisusb_match(device_t self)
|
||||
{
|
||||
struct drvdb_ent *db;
|
||||
struct usb_attach_arg *uaa = device_get_ivars(self);
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(self);
|
||||
|
||||
if (uaa->usb2_mode != USB_MODE_HOST)
|
||||
return (ENXIO);
|
||||
if (uaa->info.bConfigIndex != NDISUSB_CONFIG_NO)
|
||||
return (ENXIO);
|
||||
if (uaa->info.bIfaceIndex != NDISUSB_IFACE_INDEX)
|
||||
return (ENXIO);
|
||||
|
||||
if (windrv_lookup(0, "USB Bus") == NULL)
|
||||
return (UMATCH_NONE);
|
||||
|
||||
if (uaa->iface != NULL)
|
||||
return (UMATCH_NONE);
|
||||
return (ENXIO);
|
||||
|
||||
db = windrv_match((matchfuncptr)ndisusb_devcompare, self);
|
||||
if (db == NULL)
|
||||
return (UMATCH_NONE);
|
||||
return (ENXIO);
|
||||
uaa->driver_info = db;
|
||||
|
||||
return (UMATCH_VENDOR_PRODUCT);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
ndisusb_attach(device_t self)
|
||||
{
|
||||
struct drvdb_ent *db;
|
||||
const struct drvdb_ent *db;
|
||||
struct ndisusb_softc *dummy = device_get_softc(self);
|
||||
struct usb_attach_arg *uaa = device_get_ivars(self);
|
||||
struct usb2_attach_arg *uaa = device_get_ivars(self);
|
||||
struct ndis_softc *sc;
|
||||
struct ndis_usb_type *t;
|
||||
driver_object *drv;
|
||||
int devidx = 0;
|
||||
usbd_status status;
|
||||
|
||||
db = uaa->driver_info;
|
||||
sc = (struct ndis_softc *)dummy;
|
||||
|
||||
if (uaa->device == NULL)
|
||||
return ENXIO;
|
||||
|
||||
db = windrv_match((matchfuncptr)ndisusb_devcompare, self);
|
||||
if (db == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
sc->ndis_dev = self;
|
||||
sc->ndis_dobj = db->windrv_object;
|
||||
sc->ndis_regvals = db->windrv_regvals;
|
||||
sc->ndis_iftype = PNPBus;
|
||||
sc->ndisusb_dev = uaa->device;
|
||||
|
||||
/* Create PDO for this device instance */
|
||||
|
||||
drv = windrv_lookup(0, "USB Bus");
|
||||
windrv_create_pdo(drv, self);
|
||||
|
||||
status = usbd_set_config_no(uaa->device, NDISUSB_CONFIG_NO, 0);
|
||||
if (status != USBD_NORMAL_COMPLETION) {
|
||||
device_printf(self, "setting config no failed\n");
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
/* Figure out exactly which device we matched. */
|
||||
|
||||
t = db->windrv_devlist;
|
||||
|
||||
while (t->ndis_name != NULL) {
|
||||
if ((uaa->vendor == t->ndis_vid) &&
|
||||
(uaa->product == t->ndis_did)) {
|
||||
if ((uaa->info.idVendor == t->ndis_vid) &&
|
||||
(uaa->info.idProduct == t->ndis_did)) {
|
||||
sc->ndis_devidx = devidx;
|
||||
break;
|
||||
}
|
||||
@ -206,8 +195,6 @@ ndisusb_attach(device_t self)
|
||||
if (ndis_attach(self) != 0)
|
||||
return ENXIO;
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, uaa->device, self);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -216,28 +203,16 @@ ndisusb_detach(device_t self)
|
||||
{
|
||||
int i;
|
||||
struct ndis_softc *sc = device_get_softc(self);
|
||||
struct usb_attach_arg *uaa = device_get_ivars(self);
|
||||
struct ndisusb_ep *ne;;
|
||||
|
||||
sc->ndisusb_status |= NDISUSB_STATUS_DETACH;
|
||||
|
||||
for (i = 0; i < NDISUSB_ENDPT_MAX; i++) {
|
||||
if (sc->ndisusb_ep[i] == NULL)
|
||||
continue;
|
||||
|
||||
usbd_abort_pipe(sc->ndisusb_ep[i]);
|
||||
usbd_close_pipe(sc->ndisusb_ep[i]);
|
||||
sc->ndisusb_ep[i] = NULL;
|
||||
}
|
||||
|
||||
if (sc->ndisusb_iin_buf != NULL) {
|
||||
free(sc->ndisusb_iin_buf, M_USBDEV);
|
||||
sc->ndisusb_iin_buf = NULL;
|
||||
ne = &sc->ndisusb_ep[i];
|
||||
usb2_transfer_unsetup(ne->ne_xfer, 1);
|
||||
}
|
||||
|
||||
ndis_pnpevent_nic(self, NDIS_PNP_EVENT_SURPRISE_REMOVED);
|
||||
ndis_cancel_timerlist();
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, uaa->device, self);
|
||||
|
||||
return ndis_detach(self);
|
||||
}
|
||||
|
@ -113,15 +113,33 @@ struct ndis_vap {
|
||||
};
|
||||
#define NDIS_VAP(vap) ((struct ndis_vap *)(vap))
|
||||
|
||||
#define NDISUSB_CONFIG_NO 1
|
||||
#define NDISUSB_CONFIG_NO 0
|
||||
#define NDISUSB_IFACE_INDEX 0
|
||||
/* XXX at USB2 there's no USBD_NO_TIMEOUT macro anymore */
|
||||
#define NDISUSB_NO_TIMEOUT 0
|
||||
#define NDISUSB_INTR_TIMEOUT 1000
|
||||
#define NDISUSB_TX_TIMEOUT 10000
|
||||
struct ndisusb_xfer;
|
||||
struct ndisusb_ep {
|
||||
struct usb2_xfer *ne_xfer[1];
|
||||
list_entry ne_active;
|
||||
list_entry ne_pending;
|
||||
kspin_lock ne_lock;
|
||||
uint8_t ne_dirin;
|
||||
};
|
||||
struct ndisusb_xfer {
|
||||
usbd_xfer_handle nx_xfer;
|
||||
usbd_private_handle nx_priv;
|
||||
usbd_status nx_status;
|
||||
list_entry nx_xferlist;
|
||||
struct ndisusb_ep *nx_ep;
|
||||
void *nx_priv;
|
||||
uint8_t *nx_urbbuf;
|
||||
uint32_t nx_urbactlen;
|
||||
uint32_t nx_urblen;
|
||||
uint8_t nx_shortxfer;
|
||||
list_entry nx_next;
|
||||
};
|
||||
struct ndisusb_xferdone {
|
||||
struct ndisusb_xfer *nd_xfer;
|
||||
usb2_error_t nd_status;
|
||||
list_entry nd_donelist;
|
||||
};
|
||||
|
||||
struct ndis_softc {
|
||||
@ -201,31 +219,18 @@ struct ndis_softc {
|
||||
int ndis_tx_timer;
|
||||
int ndis_hang_timer;
|
||||
|
||||
io_workitem *ndisusb_xferitem;
|
||||
list_entry ndisusb_xferlist;
|
||||
kspin_lock ndisusb_xferlock;
|
||||
#define NDISUSB_ENDPT_BOUT 0
|
||||
#define NDISUSB_ENDPT_BIN 1
|
||||
#define NDISUSB_ENDPT_IIN 2
|
||||
#define NDISUSB_ENDPT_IOUT 3
|
||||
#define NDISUSB_ENDPT_MAX 4
|
||||
usbd_pipe_handle ndisusb_ep[NDISUSB_ENDPT_MAX];
|
||||
char *ndisusb_iin_buf;
|
||||
struct usb2_device *ndisusb_dev;
|
||||
#define NDISUSB_GET_ENDPT(addr) \
|
||||
((UE_GET_DIR(addr) >> 7) | (UE_GET_ADDR(addr) << 1))
|
||||
#define NDISUSB_ENDPT_MAX ((UE_ADDR + 1) * 2)
|
||||
struct ndisusb_ep ndisusb_ep[NDISUSB_ENDPT_MAX];
|
||||
io_workitem *ndisusb_xferdoneitem;
|
||||
list_entry ndisusb_xferdonelist;
|
||||
kspin_lock ndisusb_xferdonelock;
|
||||
int ndisusb_status;
|
||||
#define NDISUSB_STATUS_DETACH 0x1
|
||||
};
|
||||
|
||||
#define NDISMTX_LOCK(_sc) mtx_lock(&(_sc)->ndis_mtx)
|
||||
#define NDISMTX_UNLOCK(_sc) mtx_unlock(&(_sc)->ndis_mtx)
|
||||
#define NDISUSB_LOCK(_sc) mtx_lock(&Giant)
|
||||
#define NDISUSB_UNLOCK(_sc) mtx_unlock(&Giant)
|
||||
#define NDIS_LOCK(_sc) do { \
|
||||
if ((_sc)->ndis_iftype == PNPBus) \
|
||||
NDISUSB_LOCK(_sc); \
|
||||
NDISMTX_LOCK(_sc); \
|
||||
} while (0)
|
||||
#define NDIS_UNLOCK(_sc) do { \
|
||||
if ((_sc)->ndis_iftype == PNPBus) \
|
||||
NDISUSB_UNLOCK(_sc); \
|
||||
NDISMTX_UNLOCK(_sc); \
|
||||
} while (0)
|
||||
#define NDIS_LOCK(_sc) mtx_lock(&(_sc)->ndis_mtx)
|
||||
#define NDIS_UNLOCK(_sc) mtx_unlock(&(_sc)->ndis_mtx)
|
||||
#define NDIS_LOCK_ASSERT(_sc, t) mtx_assert(&(_sc)->ndis_mtx, t)
|
||||
|
@ -5,6 +5,6 @@
|
||||
KMOD= if_ndis
|
||||
SRCS= if_ndis.c if_ndis_pci.c if_ndis_pccard.c if_ndis_usb.c
|
||||
SRCS+= device_if.h bus_if.h pci_if.h card_if.h pccarddevs.h
|
||||
SRCS+= opt_usb.h usbdevs.h
|
||||
SRCS+= opt_bus.h opt_usb.h usb_if.h usbdevs.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -6,7 +6,7 @@ KMOD= ndis
|
||||
SRCS= subr_pe.c subr_ndis.c subr_hal.c subr_ntoskrnl.c kern_ndis.c
|
||||
SRCS+= kern_windrv.c subr_usbd.c
|
||||
SRCS+= device_if.h bus_if.h pci_if.h vnode_if.h
|
||||
SRCS+= opt_usb.h usbdevs.h
|
||||
SRCS+= opt_bus.h opt_usb.h usb_if.h usbdevs.h
|
||||
|
||||
.if ${MACHINE_ARCH} == "amd64"
|
||||
SRCS+= winx64_wrap.S
|
||||
|
Loading…
x
Reference in New Issue
Block a user