diff --git a/sys/compat/ndis/hal_var.h b/sys/compat/ndis/hal_var.h index 69950b30c06c..11651ce09635 100644 --- a/sys/compat/ndis/hal_var.h +++ b/sys/compat/ndis/hal_var.h @@ -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); diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c index 4d32a8b67b80..1ccef55efd1f 100644 --- a/sys/compat/ndis/kern_ndis.c +++ b/sys/compat/ndis/kern_ndis.c @@ -65,8 +65,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include #include #include @@ -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); diff --git a/sys/compat/ndis/kern_windrv.c b/sys/compat/ndis/kern_windrv.c index 37bbbaf0a0d7..2824bcd5470a 100644 --- a/sys/compat/ndis/kern_windrv.c +++ b/sys/compat/ndis/kern_windrv.c @@ -56,8 +56,7 @@ __FBSDID("$FreeBSD$"); #include #endif -#include -#include +#include #include #include @@ -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; { diff --git a/sys/compat/ndis/ndis_var.h b/sys/compat/ndis/ndis_var.h index 6608f0c92dfe..a66a1d71adf0 100644 --- a/sys/compat/ndis/ndis_var.h +++ b/sys/compat/ndis/ndis_var.h @@ -33,7 +33,7 @@ */ #ifndef _NDIS_VAR_H_ -#define _NDIS_VAR_H_ +#define _NDIS_VAR_H_ /* Forward declarations */ struct ndis_miniport_block; @@ -55,122 +55,122 @@ typedef uint8_t ndis_kirql; * NT status codes. */ -#define NDIS_STATUS_SUCCESS 0 -#define NDIS_STATUS_PENDING 0x00000103 -#define NDIS_STATUS_NOT_RECOGNIZED 0x00010001 -#define NDIS_STATUS_NOT_COPIED 0x00010002 -#define NDIS_STATUS_NOT_ACCEPTED 0x00010003 -#define NDIS_STATUS_CALL_ACTIVE 0x00010007 -#define NDIS_STATUS_ONLINE 0x40010003 -#define NDIS_STATUS_RESET_START 0x40010004 -#define NDIS_STATUS_RESET_END 0x40010005 -#define NDIS_STATUS_RING_STATUS 0x40010006 -#define NDIS_STATUS_CLOSED 0x40010007 -#define NDIS_STATUS_WAN_LINE_UP 0x40010008 -#define NDIS_STATUS_WAN_LINE_DOWN 0x40010009 -#define NDIS_STATUS_WAN_FRAGMENT 0x4001000A -#define NDIS_STATUS_MEDIA_CONNECT 0x4001000B -#define NDIS_STATUS_MEDIA_DISCONNECT 0x4001000C -#define NDIS_STATUS_HARDWARE_LINE_UP 0x4001000D -#define NDIS_STATUS_HARDWARE_LINE_DOWN 0x4001000E -#define NDIS_STATUS_INTERFACE_UP 0x4001000F -#define NDIS_STATUS_INTERFACE_DOWN 0x40010010 -#define NDIS_STATUS_MEDIA_BUSY 0x40010011 -#define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012 -#define NDIS_STATUS_WW_INDICATION NDIS_STATUS_MEDIA_SPECIFIC_INDICATION -#define NDIS_STATUS_LINK_SPEED_CHANGE 0x40010013 -#define NDIS_STATUS_WAN_GET_STATS 0x40010014 -#define NDIS_STATUS_WAN_CO_FRAGMENT 0x40010015 -#define NDIS_STATUS_WAN_CO_LINKPARAMS 0x40010016 -#define NDIS_STATUS_NOT_RESETTABLE 0x80010001 -#define NDIS_STATUS_SOFT_ERRORS 0x80010003 -#define NDIS_STATUS_HARD_ERRORS 0x80010004 -#define NDIS_STATUS_BUFFER_OVERFLOW 0x80000005 -#define NDIS_STATUS_FAILURE 0xC0000001 -#define NDIS_STATUS_RESOURCES 0xC000009A -#define NDIS_STATUS_CLOSING 0xC0010002 -#define NDIS_STATUS_BAD_VERSION 0xC0010004 -#define NDIS_STATUS_BAD_CHARACTERISTICS 0xC0010005 -#define NDIS_STATUS_ADAPTER_NOT_FOUND 0xC0010006 -#define NDIS_STATUS_OPEN_FAILED 0xC0010007 -#define NDIS_STATUS_DEVICE_FAILED 0xC0010008 -#define NDIS_STATUS_MULTICAST_FULL 0xC0010009 -#define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A -#define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B -#define NDIS_STATUS_REQUEST_ABORTED 0xC001000C -#define NDIS_STATUS_RESET_IN_PROGRESS 0xC001000D -#define NDIS_STATUS_CLOSING_INDICATING 0xC001000E -#define NDIS_STATUS_NOT_SUPPORTED 0xC00000BB -#define NDIS_STATUS_INVALID_PACKET 0xC001000F -#define NDIS_STATUS_OPEN_LIST_FULL 0xC0010010 -#define NDIS_STATUS_ADAPTER_NOT_READY 0xC0010011 -#define NDIS_STATUS_ADAPTER_NOT_OPEN 0xC0010012 -#define NDIS_STATUS_NOT_INDICATING 0xC0010013 -#define NDIS_STATUS_INVALID_LENGTH 0xC0010014 -#define NDIS_STATUS_INVALID_DATA 0xC0010015 -#define NDIS_STATUS_BUFFER_TOO_SHORT 0xC0010016 -#define NDIS_STATUS_INVALID_OID 0xC0010017 -#define NDIS_STATUS_ADAPTER_REMOVED 0xC0010018 -#define NDIS_STATUS_UNSUPPORTED_MEDIA 0xC0010019 -#define NDIS_STATUS_GROUP_ADDRESS_IN_USE 0xC001001A -#define NDIS_STATUS_FILE_NOT_FOUND 0xC001001B -#define NDIS_STATUS_ERROR_READING_FILE 0xC001001C -#define NDIS_STATUS_ALREADY_MAPPED 0xC001001D -#define NDIS_STATUS_RESOURCE_CONFLICT 0xC001001E -#define NDIS_STATUS_NO_CABLE 0xC001001F -#define NDIS_STATUS_INVALID_SAP 0xC0010020 -#define NDIS_STATUS_SAP_IN_USE 0xC0010021 -#define NDIS_STATUS_INVALID_ADDRESS 0xC0010022 -#define NDIS_STATUS_VC_NOT_ACTIVATED 0xC0010023 -#define NDIS_STATUS_DEST_OUT_OF_ORDER 0xC0010024 -#define NDIS_STATUS_VC_NOT_AVAILABLE 0xC0010025 -#define NDIS_STATUS_CELLRATE_NOT_AVAILABLE 0xC0010026 -#define NDIS_STATUS_INCOMPATABLE_QOS 0xC0010027 -#define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED 0xC0010028 -#define NDIS_STATUS_NO_ROUTE_TO_DESTINATION 0xC0010029 -#define NDIS_STATUS_TOKEN_RING_OPEN_ERROR 0xC0011000 -#define NDIS_STATUS_INVALID_DEVICE_REQUEST 0xC0000010 -#define NDIS_STATUS_NETWORK_UNREACHABLE 0xC000023C +#define NDIS_STATUS_SUCCESS 0 +#define NDIS_STATUS_PENDING 0x00000103 +#define NDIS_STATUS_NOT_RECOGNIZED 0x00010001 +#define NDIS_STATUS_NOT_COPIED 0x00010002 +#define NDIS_STATUS_NOT_ACCEPTED 0x00010003 +#define NDIS_STATUS_CALL_ACTIVE 0x00010007 +#define NDIS_STATUS_ONLINE 0x40010003 +#define NDIS_STATUS_RESET_START 0x40010004 +#define NDIS_STATUS_RESET_END 0x40010005 +#define NDIS_STATUS_RING_STATUS 0x40010006 +#define NDIS_STATUS_CLOSED 0x40010007 +#define NDIS_STATUS_WAN_LINE_UP 0x40010008 +#define NDIS_STATUS_WAN_LINE_DOWN 0x40010009 +#define NDIS_STATUS_WAN_FRAGMENT 0x4001000A +#define NDIS_STATUS_MEDIA_CONNECT 0x4001000B +#define NDIS_STATUS_MEDIA_DISCONNECT 0x4001000C +#define NDIS_STATUS_HARDWARE_LINE_UP 0x4001000D +#define NDIS_STATUS_HARDWARE_LINE_DOWN 0x4001000E +#define NDIS_STATUS_INTERFACE_UP 0x4001000F +#define NDIS_STATUS_INTERFACE_DOWN 0x40010010 +#define NDIS_STATUS_MEDIA_BUSY 0x40010011 +#define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012 +#define NDIS_STATUS_WW_INDICATION NDIS_STATUS_MEDIA_SPECIFIC_INDICATION +#define NDIS_STATUS_LINK_SPEED_CHANGE 0x40010013 +#define NDIS_STATUS_WAN_GET_STATS 0x40010014 +#define NDIS_STATUS_WAN_CO_FRAGMENT 0x40010015 +#define NDIS_STATUS_WAN_CO_LINKPARAMS 0x40010016 +#define NDIS_STATUS_NOT_RESETTABLE 0x80010001 +#define NDIS_STATUS_SOFT_ERRORS 0x80010003 +#define NDIS_STATUS_HARD_ERRORS 0x80010004 +#define NDIS_STATUS_BUFFER_OVERFLOW 0x80000005 +#define NDIS_STATUS_FAILURE 0xC0000001 +#define NDIS_STATUS_RESOURCES 0xC000009A +#define NDIS_STATUS_CLOSING 0xC0010002 +#define NDIS_STATUS_BAD_VERSION 0xC0010004 +#define NDIS_STATUS_BAD_CHARACTERISTICS 0xC0010005 +#define NDIS_STATUS_ADAPTER_NOT_FOUND 0xC0010006 +#define NDIS_STATUS_OPEN_FAILED 0xC0010007 +#define NDIS_STATUS_DEVICE_FAILED 0xC0010008 +#define NDIS_STATUS_MULTICAST_FULL 0xC0010009 +#define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A +#define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B +#define NDIS_STATUS_REQUEST_ABORTED 0xC001000C +#define NDIS_STATUS_RESET_IN_PROGRESS 0xC001000D +#define NDIS_STATUS_CLOSING_INDICATING 0xC001000E +#define NDIS_STATUS_NOT_SUPPORTED 0xC00000BB +#define NDIS_STATUS_INVALID_PACKET 0xC001000F +#define NDIS_STATUS_OPEN_LIST_FULL 0xC0010010 +#define NDIS_STATUS_ADAPTER_NOT_READY 0xC0010011 +#define NDIS_STATUS_ADAPTER_NOT_OPEN 0xC0010012 +#define NDIS_STATUS_NOT_INDICATING 0xC0010013 +#define NDIS_STATUS_INVALID_LENGTH 0xC0010014 +#define NDIS_STATUS_INVALID_DATA 0xC0010015 +#define NDIS_STATUS_BUFFER_TOO_SHORT 0xC0010016 +#define NDIS_STATUS_INVALID_OID 0xC0010017 +#define NDIS_STATUS_ADAPTER_REMOVED 0xC0010018 +#define NDIS_STATUS_UNSUPPORTED_MEDIA 0xC0010019 +#define NDIS_STATUS_GROUP_ADDRESS_IN_USE 0xC001001A +#define NDIS_STATUS_FILE_NOT_FOUND 0xC001001B +#define NDIS_STATUS_ERROR_READING_FILE 0xC001001C +#define NDIS_STATUS_ALREADY_MAPPED 0xC001001D +#define NDIS_STATUS_RESOURCE_CONFLICT 0xC001001E +#define NDIS_STATUS_NO_CABLE 0xC001001F +#define NDIS_STATUS_INVALID_SAP 0xC0010020 +#define NDIS_STATUS_SAP_IN_USE 0xC0010021 +#define NDIS_STATUS_INVALID_ADDRESS 0xC0010022 +#define NDIS_STATUS_VC_NOT_ACTIVATED 0xC0010023 +#define NDIS_STATUS_DEST_OUT_OF_ORDER 0xC0010024 +#define NDIS_STATUS_VC_NOT_AVAILABLE 0xC0010025 +#define NDIS_STATUS_CELLRATE_NOT_AVAILABLE 0xC0010026 +#define NDIS_STATUS_INCOMPATABLE_QOS 0xC0010027 +#define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED 0xC0010028 +#define NDIS_STATUS_NO_ROUTE_TO_DESTINATION 0xC0010029 +#define NDIS_STATUS_TOKEN_RING_OPEN_ERROR 0xC0011000 +#define NDIS_STATUS_INVALID_DEVICE_REQUEST 0xC0000010 +#define NDIS_STATUS_NETWORK_UNREACHABLE 0xC000023C /* * NDIS event codes. They are usually reported to NdisWriteErrorLogEntry(). */ -#define EVENT_NDIS_RESOURCE_CONFLICT 0xC0001388 -#define EVENT_NDIS_OUT_OF_RESOURCE 0xC0001389 -#define EVENT_NDIS_HARDWARE_FAILURE 0xC000138A -#define EVENT_NDIS_ADAPTER_NOT_FOUND 0xC000138B -#define EVENT_NDIS_INTERRUPT_CONNECT 0xC000138C -#define EVENT_NDIS_DRIVER_FAILURE 0xC000138D -#define EVENT_NDIS_BAD_VERSION 0xC000138E -#define EVENT_NDIS_TIMEOUT 0x8000138F -#define EVENT_NDIS_NETWORK_ADDRESS 0xC0001390 -#define EVENT_NDIS_UNSUPPORTED_CONFIGURATION 0xC0001391 -#define EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER 0xC0001392 -#define EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER 0xC0001393 -#define EVENT_NDIS_BAD_IO_BASE_ADDRESS 0xC0001394 -#define EVENT_NDIS_RECEIVE_SPACE_SMALL 0x40001395 -#define EVENT_NDIS_ADAPTER_DISABLED 0x80001396 -#define EVENT_NDIS_IO_PORT_CONFLICT 0x80001397 -#define EVENT_NDIS_PORT_OR_DMA_CONFLICT 0x80001398 -#define EVENT_NDIS_MEMORY_CONFLICT 0x80001399 -#define EVENT_NDIS_INTERRUPT_CONFLICT 0x8000139A -#define EVENT_NDIS_DMA_CONFLICT 0x8000139B -#define EVENT_NDIS_INVALID_DOWNLOAD_FILE_ERROR 0xC000139C -#define EVENT_NDIS_MAXRECEIVES_ERROR 0x8000139D -#define EVENT_NDIS_MAXTRANSMITS_ERROR 0x8000139E -#define EVENT_NDIS_MAXFRAMESIZE_ERROR 0x8000139F -#define EVENT_NDIS_MAXINTERNALBUFS_ERROR 0x800013A0 -#define EVENT_NDIS_MAXMULTICAST_ERROR 0x800013A1 -#define EVENT_NDIS_PRODUCTID_ERROR 0x800013A2 -#define EVENT_NDIS_LOBE_FAILUE_ERROR 0x800013A3 -#define EVENT_NDIS_SIGNAL_LOSS_ERROR 0x800013A4 -#define EVENT_NDIS_REMOVE_RECEIVED_ERROR 0x800013A5 -#define EVENT_NDIS_TOKEN_RING_CORRECTION 0x400013A6 -#define EVENT_NDIS_ADAPTER_CHECK_ERROR 0xC00013A7 -#define EVENT_NDIS_RESET_FAILURE_ERROR 0x800013A8 -#define EVENT_NDIS_CABLE_DISCONNECTED_ERROR 0x800013A9 -#define EVENT_NDIS_RESET_FAILURE_CORRECTION 0x800013AA +#define EVENT_NDIS_RESOURCE_CONFLICT 0xC0001388 +#define EVENT_NDIS_OUT_OF_RESOURCE 0xC0001389 +#define EVENT_NDIS_HARDWARE_FAILURE 0xC000138A +#define EVENT_NDIS_ADAPTER_NOT_FOUND 0xC000138B +#define EVENT_NDIS_INTERRUPT_CONNECT 0xC000138C +#define EVENT_NDIS_DRIVER_FAILURE 0xC000138D +#define EVENT_NDIS_BAD_VERSION 0xC000138E +#define EVENT_NDIS_TIMEOUT 0x8000138F +#define EVENT_NDIS_NETWORK_ADDRESS 0xC0001390 +#define EVENT_NDIS_UNSUPPORTED_CONFIGURATION 0xC0001391 +#define EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER 0xC0001392 +#define EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER 0xC0001393 +#define EVENT_NDIS_BAD_IO_BASE_ADDRESS 0xC0001394 +#define EVENT_NDIS_RECEIVE_SPACE_SMALL 0x40001395 +#define EVENT_NDIS_ADAPTER_DISABLED 0x80001396 +#define EVENT_NDIS_IO_PORT_CONFLICT 0x80001397 +#define EVENT_NDIS_PORT_OR_DMA_CONFLICT 0x80001398 +#define EVENT_NDIS_MEMORY_CONFLICT 0x80001399 +#define EVENT_NDIS_INTERRUPT_CONFLICT 0x8000139A +#define EVENT_NDIS_DMA_CONFLICT 0x8000139B +#define EVENT_NDIS_INVALID_DOWNLOAD_FILE_ERROR 0xC000139C +#define EVENT_NDIS_MAXRECEIVES_ERROR 0x8000139D +#define EVENT_NDIS_MAXTRANSMITS_ERROR 0x8000139E +#define EVENT_NDIS_MAXFRAMESIZE_ERROR 0x8000139F +#define EVENT_NDIS_MAXINTERNALBUFS_ERROR 0x800013A0 +#define EVENT_NDIS_MAXMULTICAST_ERROR 0x800013A1 +#define EVENT_NDIS_PRODUCTID_ERROR 0x800013A2 +#define EVENT_NDIS_LOBE_FAILUE_ERROR 0x800013A3 +#define EVENT_NDIS_SIGNAL_LOSS_ERROR 0x800013A4 +#define EVENT_NDIS_REMOVE_RECEIVED_ERROR 0x800013A5 +#define EVENT_NDIS_TOKEN_RING_CORRECTION 0x400013A6 +#define EVENT_NDIS_ADAPTER_CHECK_ERROR 0xC00013A7 +#define EVENT_NDIS_RESET_FAILURE_ERROR 0x800013A8 +#define EVENT_NDIS_CABLE_DISCONNECTED_ERROR 0x800013A9 +#define EVENT_NDIS_RESET_FAILURE_CORRECTION 0x800013AA /* * NDIS OIDs used by the queryinfo/setinfo routines. @@ -181,178 +181,178 @@ typedef uint8_t ndis_kirql; */ /* Required OIDs */ -#define OID_GEN_SUPPORTED_LIST 0x00010101 -#define OID_GEN_HARDWARE_STATUS 0x00010102 -#define OID_GEN_MEDIA_SUPPORTED 0x00010103 -#define OID_GEN_MEDIA_IN_USE 0x00010104 -#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 -#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 -#define OID_GEN_LINK_SPEED 0x00010107 -#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 -#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 -#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A -#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B -#define OID_GEN_VENDOR_ID 0x0001010C -#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D -#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E -#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F -#define OID_GEN_DRIVER_VERSION 0x00010110 -#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 -#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 -#define OID_GEN_MAC_OPTIONS 0x00010113 -#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 -#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 -#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 -#define OID_GEN_SUPPORTED_GUIDS 0x00010117 -#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118 /* Set only */ -#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119 /* Set only */ -#define OID_GEN_MACHINE_NAME 0x0001021A -#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B /* Set only */ -#define OID_GEN_VLAN_ID 0x0001021C +#define OID_GEN_SUPPORTED_LIST 0x00010101 +#define OID_GEN_HARDWARE_STATUS 0x00010102 +#define OID_GEN_MEDIA_SUPPORTED 0x00010103 +#define OID_GEN_MEDIA_IN_USE 0x00010104 +#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 +#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 +#define OID_GEN_LINK_SPEED 0x00010107 +#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 +#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 +#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A +#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B +#define OID_GEN_VENDOR_ID 0x0001010C +#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D +#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E +#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F +#define OID_GEN_DRIVER_VERSION 0x00010110 +#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 +#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 +#define OID_GEN_MAC_OPTIONS 0x00010113 +#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 +#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 +#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 +#define OID_GEN_SUPPORTED_GUIDS 0x00010117 +#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118 /* Set only */ +#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119 /* Set only */ +#define OID_GEN_MACHINE_NAME 0x0001021A +#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B /* Set only */ +#define OID_GEN_VLAN_ID 0x0001021C /* Optional OIDs. */ -#define OID_GEN_MEDIA_CAPABILITIES 0x00010201 -#define OID_GEN_PHYSICAL_MEDIUM 0x00010202 +#define OID_GEN_MEDIA_CAPABILITIES 0x00010201 +#define OID_GEN_PHYSICAL_MEDIUM 0x00010202 /* Required statistics OIDs. */ -#define OID_GEN_XMIT_OK 0x00020101 -#define OID_GEN_RCV_OK 0x00020102 -#define OID_GEN_XMIT_ERROR 0x00020103 -#define OID_GEN_RCV_ERROR 0x00020104 -#define OID_GEN_RCV_NO_BUFFER 0x00020105 +#define OID_GEN_XMIT_OK 0x00020101 +#define OID_GEN_RCV_OK 0x00020102 +#define OID_GEN_XMIT_ERROR 0x00020103 +#define OID_GEN_RCV_ERROR 0x00020104 +#define OID_GEN_RCV_NO_BUFFER 0x00020105 /* Optional OID statistics */ -#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 -#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 -#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 -#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 -#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 -#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 -#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 -#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 -#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 -#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A -#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B -#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C -#define OID_GEN_RCV_CRC_ERROR 0x0002020D -#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E -#define OID_GEN_GET_TIME_CAPS 0x0002020F -#define OID_GEN_GET_NETCARD_TIME 0x00020210 -#define OID_GEN_NETCARD_LOAD 0x00020211 -#define OID_GEN_DEVICE_PROFILE 0x00020212 +#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 +#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 +#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 +#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 +#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 +#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 +#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 +#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 +#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 +#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A +#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B +#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C +#define OID_GEN_RCV_CRC_ERROR 0x0002020D +#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E +#define OID_GEN_GET_TIME_CAPS 0x0002020F +#define OID_GEN_GET_NETCARD_TIME 0x00020210 +#define OID_GEN_NETCARD_LOAD 0x00020211 +#define OID_GEN_DEVICE_PROFILE 0x00020212 /* 802.3 (ethernet) OIDs */ -#define OID_802_3_PERMANENT_ADDRESS 0x01010101 -#define OID_802_3_CURRENT_ADDRESS 0x01010102 -#define OID_802_3_MULTICAST_LIST 0x01010103 -#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 -#define OID_802_3_MAC_OPTIONS 0x01010105 -#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 -#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 -#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 -#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 -#define OID_802_3_XMIT_DEFERRED 0x01020201 -#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 -#define OID_802_3_RCV_OVERRUN 0x01020203 -#define OID_802_3_XMIT_UNDERRUN 0x01020204 -#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 -#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 -#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 +#define OID_802_3_PERMANENT_ADDRESS 0x01010101 +#define OID_802_3_CURRENT_ADDRESS 0x01010102 +#define OID_802_3_MULTICAST_LIST 0x01010103 +#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 +#define OID_802_3_MAC_OPTIONS 0x01010105 +#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 +#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 +#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 +#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 +#define OID_802_3_XMIT_DEFERRED 0x01020201 +#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 +#define OID_802_3_RCV_OVERRUN 0x01020203 +#define OID_802_3_XMIT_UNDERRUN 0x01020204 +#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 +#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 +#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 /* PnP and power management OIDs */ -#define OID_PNP_CAPABILITIES 0xFD010100 -#define OID_PNP_SET_POWER 0xFD010101 -#define OID_PNP_QUERY_POWER 0xFD010102 -#define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103 -#define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104 -#define OID_PNP_WAKE_UP_PATTERN_LIST 0xFD010105 -#define OID_PNP_ENABLE_WAKE_UP 0xFD010106 +#define OID_PNP_CAPABILITIES 0xFD010100 +#define OID_PNP_SET_POWER 0xFD010101 +#define OID_PNP_QUERY_POWER 0xFD010102 +#define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103 +#define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104 +#define OID_PNP_WAKE_UP_PATTERN_LIST 0xFD010105 +#define OID_PNP_ENABLE_WAKE_UP 0xFD010106 /* * These are the possible power states for * OID_PNP_SET_POWER and OID_PNP_QUERY_POWER. */ -#define NDIS_POWERSTATE_UNSPEC 0 -#define NDIS_POWERSTATE_D0 1 -#define NDIS_POWERSTATE_D1 2 -#define NDIS_POWERSTATE_D2 3 -#define NDIS_POWERSTATE_D3 4 +#define NDIS_POWERSTATE_UNSPEC 0 +#define NDIS_POWERSTATE_D0 1 +#define NDIS_POWERSTATE_D1 2 +#define NDIS_POWERSTATE_D2 3 +#define NDIS_POWERSTATE_D3 4 /* * These are used with the MiniportPnpEventNotify() method. */ -#define NDIS_POWERPROFILE_BATTERY 0 -#define NDIS_POWERPROFILE_ACONLINE 1 +#define NDIS_POWERPROFILE_BATTERY 0 +#define NDIS_POWERPROFILE_ACONLINE 1 -#define NDIS_PNP_EVENT_QUERY_REMOVED 0 -#define NDIS_PNP_EVENT_REMOVED 1 -#define NDIS_PNP_EVENT_SURPRISE_REMOVED 2 -#define NDIS_PNP_EVENT_QUERY_STOPPED 3 -#define NDIS_PNP_EVENT_STOPPED 4 -#define NDIS_PNP_EVENT_PROFILECHANGED 5 +#define NDIS_PNP_EVENT_QUERY_REMOVED 0 +#define NDIS_PNP_EVENT_REMOVED 1 +#define NDIS_PNP_EVENT_SURPRISE_REMOVED 2 +#define NDIS_PNP_EVENT_QUERY_STOPPED 3 +#define NDIS_PNP_EVENT_STOPPED 4 +#define NDIS_PNP_EVENT_PROFILECHANGED 5 /* PnP/PM Statistics (Optional). */ -#define OID_PNP_WAKE_UP_OK 0xFD020200 -#define OID_PNP_WAKE_UP_ERROR 0xFD020201 +#define OID_PNP_WAKE_UP_OK 0xFD020200 +#define OID_PNP_WAKE_UP_ERROR 0xFD020201 /* The following bits are defined for OID_PNP_ENABLE_WAKE_UP */ -#define NDIS_PNP_WAKE_UP_MAGIC_PACKET 0x00000001 -#define NDIS_PNP_WAKE_UP_PATTERN_MATCH 0x00000002 -#define NDIS_PNP_WAKE_UP_LINK_CHANGE 0x00000004 +#define NDIS_PNP_WAKE_UP_MAGIC_PACKET 0x00000001 +#define NDIS_PNP_WAKE_UP_PATTERN_MATCH 0x00000002 +#define NDIS_PNP_WAKE_UP_LINK_CHANGE 0x00000004 /* 802.11 OIDs */ -#define OID_802_11_BSSID 0x0D010101 -#define OID_802_11_SSID 0x0D010102 -#define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0D010203 -#define OID_802_11_NETWORK_TYPE_IN_USE 0x0D010204 -#define OID_802_11_TX_POWER_LEVEL 0x0D010205 -#define OID_802_11_RSSI 0x0D010206 -#define OID_802_11_RSSI_TRIGGER 0x0D010207 -#define OID_802_11_INFRASTRUCTURE_MODE 0x0D010108 -#define OID_802_11_FRAGMENTATION_THRESHOLD 0x0D010209 -#define OID_802_11_RTS_THRESHOLD 0x0D01020A -#define OID_802_11_NUMBER_OF_ANTENNAS 0x0D01020B -#define OID_802_11_RX_ANTENNA_SELECTED 0x0D01020C -#define OID_802_11_TX_ANTENNA_SELECTED 0x0D01020D -#define OID_802_11_SUPPORTED_RATES 0x0D01020E -#define OID_802_11_DESIRED_RATES 0x0D010210 -#define OID_802_11_CONFIGURATION 0x0D010211 -#define OID_802_11_STATISTICS 0x0D020212 -#define OID_802_11_ADD_WEP 0x0D010113 -#define OID_802_11_REMOVE_WEP 0x0D010114 -#define OID_802_11_DISASSOCIATE 0x0D010115 -#define OID_802_11_POWER_MODE 0x0D010216 -#define OID_802_11_BSSID_LIST 0x0D010217 -#define OID_802_11_AUTHENTICATION_MODE 0x0D010118 -#define OID_802_11_PRIVACY_FILTER 0x0D010119 -#define OID_802_11_BSSID_LIST_SCAN 0x0D01011A -#define OID_802_11_WEP_STATUS 0x0D01011B -#define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS -#define OID_802_11_RELOAD_DEFAULTS 0x0D01011C -#define OID_802_11_ADD_KEY 0x0D01011D -#define OID_802_11_REMOVE_KEY 0x0D01011E -#define OID_802_11_ASSOCIATION_INFORMATION 0x0D01011F -#define OID_802_11_TEST 0x0D010120 -#define OID_802_11_CAPABILITY 0x0D010122 -#define OID_802_11_PMKID 0x0D010123 +#define OID_802_11_BSSID 0x0D010101 +#define OID_802_11_SSID 0x0D010102 +#define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0D010203 +#define OID_802_11_NETWORK_TYPE_IN_USE 0x0D010204 +#define OID_802_11_TX_POWER_LEVEL 0x0D010205 +#define OID_802_11_RSSI 0x0D010206 +#define OID_802_11_RSSI_TRIGGER 0x0D010207 +#define OID_802_11_INFRASTRUCTURE_MODE 0x0D010108 +#define OID_802_11_FRAGMENTATION_THRESHOLD 0x0D010209 +#define OID_802_11_RTS_THRESHOLD 0x0D01020A +#define OID_802_11_NUMBER_OF_ANTENNAS 0x0D01020B +#define OID_802_11_RX_ANTENNA_SELECTED 0x0D01020C +#define OID_802_11_TX_ANTENNA_SELECTED 0x0D01020D +#define OID_802_11_SUPPORTED_RATES 0x0D01020E +#define OID_802_11_DESIRED_RATES 0x0D010210 +#define OID_802_11_CONFIGURATION 0x0D010211 +#define OID_802_11_STATISTICS 0x0D020212 +#define OID_802_11_ADD_WEP 0x0D010113 +#define OID_802_11_REMOVE_WEP 0x0D010114 +#define OID_802_11_DISASSOCIATE 0x0D010115 +#define OID_802_11_POWER_MODE 0x0D010216 +#define OID_802_11_BSSID_LIST 0x0D010217 +#define OID_802_11_AUTHENTICATION_MODE 0x0D010118 +#define OID_802_11_PRIVACY_FILTER 0x0D010119 +#define OID_802_11_BSSID_LIST_SCAN 0x0D01011A +#define OID_802_11_WEP_STATUS 0x0D01011B +#define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS +#define OID_802_11_RELOAD_DEFAULTS 0x0D01011C +#define OID_802_11_ADD_KEY 0x0D01011D +#define OID_802_11_REMOVE_KEY 0x0D01011E +#define OID_802_11_ASSOCIATION_INFORMATION 0x0D01011F +#define OID_802_11_TEST 0x0D010120 +#define OID_802_11_CAPABILITY 0x0D010122 +#define OID_802_11_PMKID 0x0D010123 /* structures/definitions for 802.11 */ -#define NDIS_80211_NETTYPE_11FH 0x00000000 -#define NDIS_80211_NETTYPE_11DS 0x00000001 -#define NDIS_80211_NETTYPE_11OFDM5 0x00000002 -#define NDIS_80211_NETTYPE_11OFDM24 0x00000003 -#define NDIS_80211_NETTYPE_AUTO 0x00000004 +#define NDIS_80211_NETTYPE_11FH 0x00000000 +#define NDIS_80211_NETTYPE_11DS 0x00000001 +#define NDIS_80211_NETTYPE_11OFDM5 0x00000002 +#define NDIS_80211_NETTYPE_11OFDM24 0x00000003 +#define NDIS_80211_NETTYPE_AUTO 0x00000004 struct ndis_80211_nettype_list { uint32_t ntl_items; uint32_t ntl_type[1]; }; -#define NDIS_80211_POWERMODE_CAM 0x00000000 -#define NDIS_80211_POWERMODE_MAX_PSP 0x00000001 -#define NDIS_80211_POWERMODE_FAST_PSP 0x00000002 +#define NDIS_80211_POWERMODE_CAM 0x00000000 +#define NDIS_80211_POWERMODE_MAX_PSP 0x00000001 +#define NDIS_80211_POWERMODE_FAST_PSP 0x00000002 typedef uint32_t ndis_80211_power; /* Power in milliwatts */ typedef uint32_t ndis_80211_rssi; /* Signal strength in dBm */ @@ -405,21 +405,21 @@ struct ndis_80211_wep { typedef struct ndis_80211_wep ndis_80211_wep; -#define NDIS_80211_WEPKEY_TX 0x80000000 -#define NDIS_80211_WEPKEY_PERCLIENT 0x40000000 +#define NDIS_80211_WEPKEY_TX 0x80000000 +#define NDIS_80211_WEPKEY_PERCLIENT 0x40000000 -#define NDIS_80211_NET_INFRA_IBSS 0x00000000 -#define NDIS_80211_NET_INFRA_BSS 0x00000001 -#define NDIS_80211_NET_INFRA_AUTO 0x00000002 +#define NDIS_80211_NET_INFRA_IBSS 0x00000000 +#define NDIS_80211_NET_INFRA_BSS 0x00000001 +#define NDIS_80211_NET_INFRA_AUTO 0x00000002 -#define NDIS_80211_AUTHMODE_OPEN 0x00000000 -#define NDIS_80211_AUTHMODE_SHARED 0x00000001 -#define NDIS_80211_AUTHMODE_AUTO 0x00000002 -#define NDIS_80211_AUTHMODE_WPA 0x00000003 -#define NDIS_80211_AUTHMODE_WPAPSK 0x00000004 -#define NDIS_80211_AUTHMODE_WPANONE 0x00000005 -#define NDIS_80211_AUTHMODE_WPA2 0x00000006 -#define NDIS_80211_AUTHMODE_WPA2PSK 0x00000007 +#define NDIS_80211_AUTHMODE_OPEN 0x00000000 +#define NDIS_80211_AUTHMODE_SHARED 0x00000001 +#define NDIS_80211_AUTHMODE_AUTO 0x00000002 +#define NDIS_80211_AUTHMODE_WPA 0x00000003 +#define NDIS_80211_AUTHMODE_WPAPSK 0x00000004 +#define NDIS_80211_AUTHMODE_WPANONE 0x00000005 +#define NDIS_80211_AUTHMODE_WPA2 0x00000006 +#define NDIS_80211_AUTHMODE_WPA2PSK 0x00000007 typedef uint8_t ndis_80211_rates[8]; typedef uint8_t ndis_80211_rates_ex[16]; @@ -494,26 +494,26 @@ typedef uint32_t ndis_80211_fragthresh; typedef uint32_t ndis_80211_rtsthresh; typedef uint32_t ndis_80211_antenna; -#define NDIS_80211_PRIVFILT_ACCEPTALL 0x00000000 -#define NDIS_80211_PRIVFILT_8021XWEP 0x00000001 +#define NDIS_80211_PRIVFILT_ACCEPTALL 0x00000000 +#define NDIS_80211_PRIVFILT_8021XWEP 0x00000001 -#define NDIS_80211_WEPSTAT_ENABLED 0x00000000 -#define NDIS_80211_WEPSTAT_ENC1ENABLED NDIS_80211_WEPSTAT_ENABLED -#define NDIS_80211_WEPSTAT_DISABLED 0x00000001 -#define NDIS_80211_WEPSTAT_ENCDISABLED NDIS_80211_WEPSTAT_DISABLED -#define NDIS_80211_WEPSTAT_KEYABSENT 0x00000002 -#define NDIS_80211_WEPSTAT_ENC1KEYABSENT NDIS_80211_WEPSTAT_KEYABSENT -#define NDIS_80211_WEPSTAT_NOTSUPPORTED 0x00000003 -#define NDIS_80211_WEPSTAT_ENCNOTSUPPORTED NDIS_80211_WEPSTAT_NOTSUPPORTED -#define NDIS_80211_WEPSTAT_ENC2ENABLED 0x00000004 -#define NDIS_80211_WEPSTAT_ENC2KEYABSENT 0x00000005 -#define NDIS_80211_WEPSTAT_ENC3ENABLED 0x00000006 -#define NDIS_80211_WEPSTAT_ENC3KEYABSENT 0x00000007 +#define NDIS_80211_WEPSTAT_ENABLED 0x00000000 +#define NDIS_80211_WEPSTAT_ENC1ENABLED NDIS_80211_WEPSTAT_ENABLED +#define NDIS_80211_WEPSTAT_DISABLED 0x00000001 +#define NDIS_80211_WEPSTAT_ENCDISABLED NDIS_80211_WEPSTAT_DISABLED +#define NDIS_80211_WEPSTAT_KEYABSENT 0x00000002 +#define NDIS_80211_WEPSTAT_ENC1KEYABSENT NDIS_80211_WEPSTAT_KEYABSENT +#define NDIS_80211_WEPSTAT_NOTSUPPORTED 0x00000003 +#define NDIS_80211_WEPSTAT_ENCNOTSUPPORTED NDIS_80211_WEPSTAT_NOTSUPPORTED +#define NDIS_80211_WEPSTAT_ENC2ENABLED 0x00000004 +#define NDIS_80211_WEPSTAT_ENC2KEYABSENT 0x00000005 +#define NDIS_80211_WEPSTAT_ENC3ENABLED 0x00000006 +#define NDIS_80211_WEPSTAT_ENC3KEYABSENT 0x00000007 -#define NDIS_80211_RELOADDEFAULT_WEP 0x00000000 +#define NDIS_80211_RELOADDEFAULT_WEP 0x00000000 -#define NDIS_80211_STATUSTYPE_AUTH 0x00000000 -#define NDIS_80211_STATUSTYPE_PMKIDLIST 0x00000001 +#define NDIS_80211_STATUSTYPE_AUTH 0x00000000 +#define NDIS_80211_STATUSTYPE_PMKIDLIST 0x00000001 struct ndis_80211_status_indication { uint32_t nsi_type; @@ -521,10 +521,10 @@ struct ndis_80211_status_indication { typedef struct ndis_80211_status_indication ndis_80211_status_indication; -#define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01 -#define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02 -#define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06 -#define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E +#define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01 +#define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02 +#define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06 +#define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E struct ndis_80211_auth_request { uint32_t nar_len; @@ -554,13 +554,13 @@ struct ndis_80211_remove_key { typedef struct ndis_80211_remove_key ndis_80211_remove_key; -#define NDIS_80211_AI_REQFI_CAPABILITIES 0x00000001 -#define NDIS_80211_AI_REQFI_LISTENINTERVAL 0x00000002 -#define NDIS_80211_AI_REQFI_CURRENTAPADDRESS 0x00000004 +#define NDIS_80211_AI_REQFI_CAPABILITIES 0x00000001 +#define NDIS_80211_AI_REQFI_LISTENINTERVAL 0x00000002 +#define NDIS_80211_AI_REQFI_CURRENTAPADDRESS 0x00000004 -#define NDIS_80211_AI_RESFI_CAPABILITIES 0x00000001 -#define NDIS_80211_AI_RESFI_STATUSCODE 0x00000002 -#define NDIS_80211_AI_RESFI_ASSOCIATIONID 0x00000004 +#define NDIS_80211_AI_RESFI_CAPABILITIES 0x00000001 +#define NDIS_80211_AI_RESFI_STATUSCODE 0x00000002 +#define NDIS_80211_AI_RESFI_ASSOCIATIONID 0x00000004 struct ndis_80211_ai_reqfi { uint16_t naq_caps; @@ -616,7 +616,7 @@ struct ndis_80211_auth_encrypt { }; typedef struct ndis_80211_auth_encrypt ndis_80211_auth_encrypt; - + struct ndis_80211_caps { uint32_t nc_len; uint32_t nc_ver; @@ -648,7 +648,7 @@ struct ndis_80211_pmkid_cand { typedef struct ndis_80211_pmkid_cand ndis_80211_pmkid_cand; -#define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED (0x01) +#define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED (0x01) struct ndis_80211_pmkid_candidate_list { uint32_t npcl_version; @@ -667,26 +667,26 @@ typedef struct ndis_80211_enc_indication ndis_80211_enc_indication; /* TCP OIDs. */ -#define OID_TCP_TASK_OFFLOAD 0xFC010201 -#define OID_TCP_TASK_IPSEC_ADD_SA 0xFC010202 -#define OID_TCP_TASK_IPSEC_DELETE_SA 0xFC010203 -#define OID_TCP_SAN_SUPPORT 0xFC010204 +#define OID_TCP_TASK_OFFLOAD 0xFC010201 +#define OID_TCP_TASK_IPSEC_ADD_SA 0xFC010202 +#define OID_TCP_TASK_IPSEC_DELETE_SA 0xFC010203 +#define OID_TCP_SAN_SUPPORT 0xFC010204 -#define NDIS_TASK_OFFLOAD_VERSION 1 +#define NDIS_TASK_OFFLOAD_VERSION 1 -#define NDIS_TASK_TCPIP_CSUM 0x00000000 -#define NDIS_TASK_IPSEC 0x00000001 -#define NDIS_TASK_TCP_LARGESEND 0x00000002 +#define NDIS_TASK_TCPIP_CSUM 0x00000000 +#define NDIS_TASK_IPSEC 0x00000001 +#define NDIS_TASK_TCP_LARGESEND 0x00000002 -#define NDIS_ENCAP_UNSPEC 0x00000000 -#define NDIS_ENCAP_NULL 0x00000001 -#define NDIS_ENCAP_IEEE802_3 0x00000002 -#define NDIS_ENCAP_IEEE802_5 0x00000003 -#define NDIS_ENCAP_SNAP_ROUTED 0x00000004 -#define NDIS_ENCAP_SNAP_BRIDGED 0x00000005 +#define NDIS_ENCAP_UNSPEC 0x00000000 +#define NDIS_ENCAP_NULL 0x00000001 +#define NDIS_ENCAP_IEEE802_3 0x00000002 +#define NDIS_ENCAP_IEEE802_5 0x00000003 +#define NDIS_ENCAP_SNAP_ROUTED 0x00000004 +#define NDIS_ENCAP_SNAP_BRIDGED 0x00000005 -#define NDIS_ENCAPFLAG_FIXEDHDRLEN 0x00000001 +#define NDIS_ENCAPFLAG_FIXEDHDRLEN 0x00000001 struct ndis_encap_fmt { uint32_t nef_encap; @@ -717,11 +717,11 @@ struct ndis_task_offload { typedef struct ndis_task_offload ndis_task_offload; -#define NDIS_TCPSUM_FLAGS_IP_OPTS 0x00000001 -#define NDIS_TCPSUM_FLAGS_TCP_OPTS 0x00000002 -#define NDIS_TCPSUM_FLAGS_TCP_CSUM 0x00000004 -#define NDIS_TCPSUM_FLAGS_UDP_CSUM 0x00000008 -#define NDIS_TCPSUM_FLAGS_IP_CSUM 0x00000010 +#define NDIS_TCPSUM_FLAGS_IP_OPTS 0x00000001 +#define NDIS_TCPSUM_FLAGS_TCP_OPTS 0x00000002 +#define NDIS_TCPSUM_FLAGS_TCP_CSUM 0x00000004 +#define NDIS_TCPSUM_FLAGS_UDP_CSUM 0x00000008 +#define NDIS_TCPSUM_FLAGS_IP_CSUM 0x00000010 struct ndis_task_tcpip_csum { uint32_t nttc_v4tx; @@ -742,21 +742,21 @@ struct ndis_task_tcp_largesend { typedef struct ndis_task_tcp_largesend ndis_task_tcp_largesend; -#define NDIS_IPSEC_AH_MD5 0x00000001 -#define NDIS_IPSEC_AH_SHA1 0x00000002 -#define NDIS_IPSEC_AH_TRANSPORT 0x00000004 -#define NDIS_IPSEC_AH_TUNNEL 0x00000008 -#define NDIS_IPSEC_AH_SEND 0x00000010 -#define NDIS_IPSEC_AH_RECEIVE 0x00000020 +#define NDIS_IPSEC_AH_MD5 0x00000001 +#define NDIS_IPSEC_AH_SHA1 0x00000002 +#define NDIS_IPSEC_AH_TRANSPORT 0x00000004 +#define NDIS_IPSEC_AH_TUNNEL 0x00000008 +#define NDIS_IPSEC_AH_SEND 0x00000010 +#define NDIS_IPSEC_AH_RECEIVE 0x00000020 -#define NDIS_IPSEC_ESP_DES 0x00000001 -#define NDIS_IPSEC_ESP_RSVD 0x00000002 -#define NDIS_IPSEC_ESP_3DES 0x00000004 -#define NDIS_IPSEC_ESP_NULL 0x00000008 -#define NDIS_IPSEC_ESP_TRANSPORT 0x00000010 -#define NDIS_IPSEC_ESP_TUNNEL 0x00000020 -#define NDIS_IPSEC_ESP_SEND 0x00000040 -#define NDIS_IPSEC_ESP_RECEIVE 0x00000080 +#define NDIS_IPSEC_ESP_DES 0x00000001 +#define NDIS_IPSEC_ESP_RSVD 0x00000002 +#define NDIS_IPSEC_ESP_3DES 0x00000004 +#define NDIS_IPSEC_ESP_NULL 0x00000008 +#define NDIS_IPSEC_ESP_TRANSPORT 0x00000010 +#define NDIS_IPSEC_ESP_TUNNEL 0x00000020 +#define NDIS_IPSEC_ESP_SEND 0x00000040 +#define NDIS_IPSEC_ESP_RECEIVE 0x00000080 struct ndis_task_ipsec { uint32_t nti_ah_esp_combined; @@ -774,18 +774,18 @@ typedef struct ndis_task_ipsec ndis_task_ipsec; * all attributes. */ -#define NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT 0x00000001 -#define NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT 0x00000002 -#define NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS 0x00000004 -#define NDIS_ATTRIBUTE_BUS_MASTER 0x00000008 -#define NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER 0x00000010 -#define NDIS_ATTRIBUTE_DESERIALIZE 0x00000020 -#define NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND 0x00000040 -#define NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK 0x00000080 -#define NDIS_ATTRIBUTE_NOT_CO_NDIS 0x00000100 -#define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS 0x00000200 +#define NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT 0x00000001 +#define NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT 0x00000002 +#define NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS 0x00000004 +#define NDIS_ATTRIBUTE_BUS_MASTER 0x00000008 +#define NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER 0x00000010 +#define NDIS_ATTRIBUTE_DESERIALIZE 0x00000020 +#define NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND 0x00000040 +#define NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK 0x00000080 +#define NDIS_ATTRIBUTE_NOT_CO_NDIS 0x00000100 +#define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS 0x00000200 -#define NDIS_SERIALIZED(block) \ +#define NDIS_SERIALIZED(block) \ (((block)->nmb_flags & NDIS_ATTRIBUTE_DESERIALIZE) == 0) enum ndis_media_state { @@ -797,37 +797,37 @@ typedef enum ndis_media_state ndis_media_state; /* Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER). */ -#define NDIS_PACKET_TYPE_DIRECTED 0x00000001 -#define NDIS_PACKET_TYPE_MULTICAST 0x00000002 -#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 -#define NDIS_PACKET_TYPE_BROADCAST 0x00000008 -#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 -#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 -#define NDIS_PACKET_TYPE_SMT 0x00000040 -#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080 -#define NDIS_PACKET_TYPE_GROUP 0x00001000 -#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000 -#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000 -#define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000 +#define NDIS_PACKET_TYPE_DIRECTED 0x00000001 +#define NDIS_PACKET_TYPE_MULTICAST 0x00000002 +#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 +#define NDIS_PACKET_TYPE_BROADCAST 0x00000008 +#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 +#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 +#define NDIS_PACKET_TYPE_SMT 0x00000040 +#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080 +#define NDIS_PACKET_TYPE_GROUP 0x00001000 +#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000 +#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000 +#define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000 /* Ndis MAC option bits (OID_GEN_MAC_OPTIONS). */ -#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 -#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 -#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004 -#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008 -#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010 -#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020 -#define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040 -#define NDIS_MAC_OPTION_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00000080 -#define NDIS_MAC_OPTION_RECEIVE_AT_DPC 0x00000100 -#define NDIS_MAC_OPTION_8021Q_VLAN 0x00000200 -#define NDIS_MAC_OPTION_RESERVED 0x80000000 +#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 +#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 +#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004 +#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008 +#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010 +#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020 +#define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040 +#define NDIS_MAC_OPTION_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00000080 +#define NDIS_MAC_OPTION_RECEIVE_AT_DPC 0x00000100 +#define NDIS_MAC_OPTION_8021Q_VLAN 0x00000200 +#define NDIS_MAC_OPTION_RESERVED 0x80000000 -#define NDIS_DMA_24BITS 0x00 -#define NDIS_DMA_32BITS 0x01 -#define NDIS_DMA_64BITS 0x02 +#define NDIS_DMA_24BITS 0x00 +#define NDIS_DMA_32BITS 0x01 +#define NDIS_DMA_64BITS 0x02 /* struct ndis_physaddr { @@ -837,7 +837,7 @@ struct ndis_physaddr { #ifdef __amd64__ uint32_t np_low; uint32_t np_high; -#define np_quad np_low +#define np_quad np_low #endif #ifdef notdef uint32_t np_low; @@ -939,7 +939,7 @@ struct dispatch_header { }; #endif -#define dispatch_header nt_dispatch_header +#define dispatch_header nt_dispatch_header struct ndis_ktimer { struct dispatch_header nk_header; @@ -1011,8 +1011,8 @@ struct ndis_rw_lock { uint8_t nrl_rsvd[16]; }; -#define nrl_spinlock u.nrl_spinlock -#define nrl_ctx u.nrl_ctx; +#define nrl_spinlock u.nrl_spinlock +#define nrl_ctx u.nrl_ctx; typedef struct ndis_rw_lock ndis_rw_lock; @@ -1080,7 +1080,7 @@ enum ndis_interrupt_mode { typedef enum ndis_interrupt_mode ndis_interrupt_mode; -#define NUMBER_OF_SINGLE_WORK_ITEMS 6 +#define NUMBER_OF_SINGLE_WORK_ITEMS 6 struct ndis_work_item; @@ -1094,7 +1094,7 @@ struct ndis_work_item { typedef struct ndis_work_item ndis_work_item; -#define NdisInitializeWorkItem(w, f, c) \ +#define NdisInitializeWorkItem(w, f, c) \ do { \ (w)->nwi_ctx = c; \ (w)->nwi_func = f; \ @@ -1123,8 +1123,8 @@ struct ndis_sc_element { typedef struct ndis_sc_element ndis_sc_element; -#define NDIS_MAXSEG 32 -#define NDIS_BUS_SPACE_SHARED_MAXADDR 0x3E7FFFFF +#define NDIS_MAXSEG 32 +#define NDIS_BUS_SPACE_SHARED_MAXADDR 0x3E7FFFFF struct ndis_sc_list { uint32_t nsl_frags; @@ -1144,19 +1144,19 @@ struct ndis_tcpip_csum { typedef struct ndis_tcpip_csum ndis_tcpip_csum; -#define NDIS_TXCSUM_DO_IPV4 0x00000001 -#define NDIS_TXCSUM_DO_IPV6 0x00000002 -#define NDIS_TXCSUM_DO_TCP 0x00000004 -#define NDIS_TXCSUM_DO_UDP 0x00000008 -#define NDIS_TXCSUM_DO_IP 0x00000010 +#define NDIS_TXCSUM_DO_IPV4 0x00000001 +#define NDIS_TXCSUM_DO_IPV6 0x00000002 +#define NDIS_TXCSUM_DO_TCP 0x00000004 +#define NDIS_TXCSUM_DO_UDP 0x00000008 +#define NDIS_TXCSUM_DO_IP 0x00000010 -#define NDIS_RXCSUM_TCP_FAILED 0x00000001 -#define NDIS_RXCSUM_UDP_FAILED 0x00000002 -#define NDIS_RXCSUM_IP_FAILED 0x00000004 -#define NDIS_RXCSUM_TCP_PASSED 0x00000008 -#define NDIS_RXCSUM_UDP_PASSED 0x00000010 -#define NDIS_RXCSUM_IP_PASSED 0x00000020 -#define NDIS_RXCSUM_LOOPBACK 0x00000040 +#define NDIS_RXCSUM_TCP_FAILED 0x00000001 +#define NDIS_RXCSUM_UDP_FAILED 0x00000002 +#define NDIS_RXCSUM_IP_FAILED 0x00000004 +#define NDIS_RXCSUM_TCP_PASSED 0x00000008 +#define NDIS_RXCSUM_UDP_PASSED 0x00000010 +#define NDIS_RXCSUM_IP_PASSED 0x00000020 +#define NDIS_RXCSUM_LOOPBACK 0x00000040 struct ndis_vlan { union { @@ -1180,7 +1180,7 @@ enum ndis_perpkt_info { ndis_sclist_info, ndis_ieee8021q_info, ndis_originalpkt_info, - ndis_packetcancelid, + ndis_packetcancelid, ndis_maxpkt_info }; @@ -1206,28 +1206,28 @@ struct ndis_packet_private { uint16_t npp_packetooboffset; }; -#define NDIS_FLAGS_PROTOCOL_ID_MASK 0x0000000F -#define NDIS_FLAGS_MULTICAST_PACKET 0x00000010 -#define NDIS_FLAGS_RESERVED2 0x00000020 -#define NDIS_FLAGS_RESERVED3 0x00000040 -#define NDIS_FLAGS_DONT_LOOPBACK 0x00000080 -#define NDIS_FLAGS_IS_LOOPBACK_PACKET 0x00000100 -#define NDIS_FLAGS_LOOPBACK_ONLY 0x00000200 -#define NDIS_FLAGS_RESERVED4 0x00000400 -#define NDIS_FLAGS_DOUBLE_BUFFERED 0x00000800 -#define NDIS_FLAGS_SENT_AT_DPC 0x00001000 -#define NDIS_FLAGS_USES_SG_BUFFER_LIST 0x00002000 +#define NDIS_FLAGS_PROTOCOL_ID_MASK 0x0000000F +#define NDIS_FLAGS_MULTICAST_PACKET 0x00000010 +#define NDIS_FLAGS_RESERVED2 0x00000020 +#define NDIS_FLAGS_RESERVED3 0x00000040 +#define NDIS_FLAGS_DONT_LOOPBACK 0x00000080 +#define NDIS_FLAGS_IS_LOOPBACK_PACKET 0x00000100 +#define NDIS_FLAGS_LOOPBACK_ONLY 0x00000200 +#define NDIS_FLAGS_RESERVED4 0x00000400 +#define NDIS_FLAGS_DOUBLE_BUFFERED 0x00000800 +#define NDIS_FLAGS_SENT_AT_DPC 0x00001000 +#define NDIS_FLAGS_USES_SG_BUFFER_LIST 0x00002000 -#define NDIS_PACKET_WRAPPER_RESERVED 0x3F -#define NDIS_PACKET_CONTAINS_MEDIA_SPECIFIC_INFO 0x40 -#define NDIS_PACKET_ALLOCATED_BY_NDIS 0x80 +#define NDIS_PACKET_WRAPPER_RESERVED 0x3F +#define NDIS_PACKET_CONTAINS_MEDIA_SPECIFIC_INFO 0x40 +#define NDIS_PACKET_ALLOCATED_BY_NDIS 0x80 -#define NDIS_PROTOCOL_ID_DEFAULT 0x00 -#define NDIS_PROTOCOL_ID_TCP_IP 0x02 -#define NDIS_PROTOCOL_ID_IPX 0x06 -#define NDIS_PROTOCOL_ID_NBF 0x07 -#define NDIS_PROTOCOL_ID_MAX 0x0F -#define NDIS_PROTOCOL_ID_MASK 0x0F +#define NDIS_PROTOCOL_ID_DEFAULT 0x00 +#define NDIS_PROTOCOL_ID_TCP_IP 0x02 +#define NDIS_PROTOCOL_ID_IPX 0x06 +#define NDIS_PROTOCOL_ID_NBF 0x07 +#define NDIS_PROTOCOL_ID_MAX 0x0F +#define NDIS_PROTOCOL_ID_MASK 0x0F typedef struct ndis_packet_private ndis_packet_private; @@ -1277,7 +1277,7 @@ struct ndis_ethpriv { typedef struct ndis_ethpriv ndis_ethpriv; -#define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(void *)) +#define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(void *)) struct ndis_packet { ndis_packet_private np_private; @@ -1332,10 +1332,10 @@ struct ndis_packet_pool { typedef struct ndis_packet_pool ndis_packet_pool; /* mbuf ext type for NDIS */ -#define EXT_NDIS EXT_NET_DRV +#define EXT_NDIS EXT_NET_DRV /* mtx type for NDIS */ -#define MTX_NDIS_LOCK "NDIS lock" +#define MTX_NDIS_LOCK "NDIS lock" struct ndis_filterdbs { union { @@ -1349,7 +1349,7 @@ struct ndis_filterdbs { typedef struct ndis_filterdbs ndis_filterdbs; -#define nf_ethdb u.nf_ethdb +#define nf_ethdb u.nf_ethdb enum ndis_medium { NdisMedium802_3, @@ -1496,15 +1496,15 @@ struct ndis_timer_entry { TAILQ_HEAD(nte_head, ndis_timer_entry); -#define NDIS_FH_TYPE_VFS 0 -#define NDIS_FH_TYPE_MODULE 1 +#define NDIS_FH_TYPE_VFS 0 +#define NDIS_FH_TYPE_MODULE 1 struct ndis_fh { int nf_type; char *nf_name; void *nf_vp; void *nf_map; - uint32_t nf_maplen; + uint32_t nf_maplen; }; typedef struct ndis_fh ndis_fh; @@ -1535,7 +1535,7 @@ struct ndis_miniport_block { /* * Windows-specific portion -- DO NOT MODIFY OR NDIS * DRIVERS WILL NOT WORK. - */ + */ void *nmb_signature; /* magic number */ ndis_miniport_block *nmb_nextminiport; ndis_mdriver_block *nmb_driverhandle; @@ -1667,13 +1667,13 @@ typedef ndis_status (*driver_entry)(void *, unicode_string *); extern image_patch_table ndis_functbl[]; -#define NDIS_TASKQUEUE 1 -#define NDIS_SWI 2 +#define NDIS_TASKQUEUE 1 +#define NDIS_SWI 2 -#define NDIS_PSTATE_RUNNING 1 -#define NDIS_PSTATE_SLEEPING 2 +#define NDIS_PSTATE_RUNNING 1 +#define NDIS_PSTATE_SLEEPING 2 -#define NdisQueryPacket(p, pbufcnt, bufcnt, firstbuf, plen) \ +#define NdisQueryPacket(p, pbufcnt, bufcnt, firstbuf, plen) \ do { \ if ((firstbuf) != NULL) { \ ndis_buffer **_first; \ @@ -1751,9 +1751,9 @@ extern int ndis_flush_sysctls(void *); extern uint32_t NdisAddDevice(driver_object *, device_object *); extern void NdisAllocatePacketPool(ndis_status *, - ndis_handle *, uint32_t, uint32_t); + ndis_handle *, uint32_t, uint32_t); extern void NdisAllocatePacketPoolEx(ndis_status *, - ndis_handle *, uint32_t, uint32_t, uint32_t); + ndis_handle *, uint32_t, uint32_t, uint32_t); extern uint32_t NdisPacketPoolUsage(ndis_handle); extern void NdisFreePacketPool(ndis_handle); extern void NdisAllocatePacket(ndis_status *, @@ -1761,7 +1761,6 @@ extern void NdisAllocatePacket(ndis_status *, extern void NdisFreePacket(ndis_packet *); extern ndis_status NdisScheduleWorkItem(ndis_work_item *); extern void NdisMSleep(uint32_t); -extern void ndis_cancel_timerlist(void); __END_DECLS #endif /* _NDIS_VAR_H_ */ diff --git a/sys/compat/ndis/ntoskrnl_var.h b/sys/compat/ndis/ntoskrnl_var.h index 73e01c4ffb9f..9ed52d8cb48d 100644 --- a/sys/compat/ndis/ntoskrnl_var.h +++ b/sys/compat/ndis/ntoskrnl_var.h @@ -33,9 +33,9 @@ */ #ifndef _NTOSKRNL_VAR_H_ -#define _NTOSKRNL_VAR_H_ +#define _NTOSKRNL_VAR_H_ -#define MTX_NTOSKRNL_SPIN_LOCK "NDIS thread lock" +#define MTX_NTOSKRNL_SPIN_LOCK "NDIS thread lock" /* * us_buf is really a wchar_t *, but it's inconvenient to include @@ -82,7 +82,7 @@ typedef struct ansi_string ansi_string; */ struct mdl { - struct mdl *mdl_next; + struct mdl *mdl_next; uint16_t mdl_size; uint16_t mdl_flags; void *mdl_process; @@ -96,50 +96,50 @@ typedef struct mdl mdl, ndis_buffer; /* MDL flags */ -#define MDL_MAPPED_TO_SYSTEM_VA 0x0001 -#define MDL_PAGES_LOCKED 0x0002 -#define MDL_SOURCE_IS_NONPAGED_POOL 0x0004 -#define MDL_ALLOCATED_FIXED_SIZE 0x0008 -#define MDL_PARTIAL 0x0010 -#define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020 -#define MDL_IO_PAGE_READ 0x0040 -#define MDL_WRITE_OPERATION 0x0080 -#define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100 -#define MDL_FREE_EXTRA_PTES 0x0200 -#define MDL_IO_SPACE 0x0800 -#define MDL_NETWORK_HEADER 0x1000 -#define MDL_MAPPING_CAN_FAIL 0x2000 -#define MDL_ALLOCATED_MUST_SUCCEED 0x4000 -#define MDL_ZONE_ALLOCED 0x8000 /* BSD private */ +#define MDL_MAPPED_TO_SYSTEM_VA 0x0001 +#define MDL_PAGES_LOCKED 0x0002 +#define MDL_SOURCE_IS_NONPAGED_POOL 0x0004 +#define MDL_ALLOCATED_FIXED_SIZE 0x0008 +#define MDL_PARTIAL 0x0010 +#define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020 +#define MDL_IO_PAGE_READ 0x0040 +#define MDL_WRITE_OPERATION 0x0080 +#define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100 +#define MDL_FREE_EXTRA_PTES 0x0200 +#define MDL_IO_SPACE 0x0800 +#define MDL_NETWORK_HEADER 0x1000 +#define MDL_MAPPING_CAN_FAIL 0x2000 +#define MDL_ALLOCATED_MUST_SUCCEED 0x4000 +#define MDL_ZONE_ALLOCED 0x8000 /* BSD private */ -#define MDL_ZONE_PAGES 16 -#define MDL_ZONE_SIZE (sizeof(mdl) + (sizeof(vm_offset_t) * MDL_ZONE_PAGES)) +#define MDL_ZONE_PAGES 16 +#define MDL_ZONE_SIZE (sizeof(mdl) + (sizeof(vm_offset_t) * MDL_ZONE_PAGES)) /* Note: assumes x86 page size of 4K. */ #ifndef PAGE_SHIFT #if PAGE_SIZE == 4096 -#define PAGE_SHIFT 12 +#define PAGE_SHIFT 12 #elif PAGE_SIZE == 8192 -#define PAGE_SHIFT 13 +#define PAGE_SHIFT 13 #else #error PAGE_SHIFT undefined! #endif #endif -#define SPAN_PAGES(ptr, len) \ +#define SPAN_PAGES(ptr, len) \ ((uint32_t)((((uintptr_t)(ptr) & (PAGE_SIZE - 1)) + \ (len) + (PAGE_SIZE - 1)) >> PAGE_SHIFT)) -#define PAGE_ALIGN(ptr) \ +#define PAGE_ALIGN(ptr) \ ((void *)((uintptr_t)(ptr) & ~(PAGE_SIZE - 1))) -#define BYTE_OFFSET(ptr) \ +#define BYTE_OFFSET(ptr) \ ((uint32_t)((uintptr_t)(ptr) & (PAGE_SIZE - 1))) -#define MDL_PAGES(m) (vm_offset_t *)(m + 1) +#define MDL_PAGES(m) (vm_offset_t *)(m + 1) -#define MmInitializeMdl(b, baseva, len) \ +#define MmInitializeMdl(b, baseva, len) \ (b)->mdl_next = NULL; \ (b)->mdl_size = (uint16_t)(sizeof(mdl) + \ (sizeof(vm_offset_t) * SPAN_PAGES((baseva), (len)))); \ @@ -148,19 +148,19 @@ typedef struct mdl mdl, ndis_buffer; (b)->mdl_byteoffset = BYTE_OFFSET((baseva)); \ (b)->mdl_bytecount = (uint32_t)(len); -#define MmGetMdlByteOffset(mdl) ((mdl)->mdl_byteoffset) -#define MmGetMdlByteCount(mdl) ((mdl)->mdl_bytecount) -#define MmGetMdlVirtualAddress(mdl) \ +#define MmGetMdlByteOffset(mdl) ((mdl)->mdl_byteoffset) +#define MmGetMdlByteCount(mdl) ((mdl)->mdl_bytecount) +#define MmGetMdlVirtualAddress(mdl) \ ((void *)((char *)((mdl)->mdl_startva) + (mdl)->mdl_byteoffset)) -#define MmGetMdlStartVa(mdl) ((mdl)->mdl_startva) -#define MmGetMdlPfnArray(mdl) MDL_PAGES(mdl) +#define MmGetMdlStartVa(mdl) ((mdl)->mdl_startva) +#define MmGetMdlPfnArray(mdl) MDL_PAGES(mdl) -#define WDM_MAJOR 1 -#define WDM_MINOR_WIN98 0x00 -#define WDM_MINOR_WINME 0x05 -#define WDM_MINOR_WIN2000 0x10 -#define WDM_MINOR_WINXP 0x20 -#define WDM_MINOR_WIN2003 0x30 +#define WDM_MAJOR 1 +#define WDM_MINOR_WIN98 0x00 +#define WDM_MINOR_WINME 0x05 +#define WDM_MINOR_WIN2000 0x10 +#define WDM_MINOR_WINXP 0x20 +#define WDM_MINOR_WIN2003 0x30 /*- * The ndis_kspin_lock type is called KSPIN_LOCK in MS-Windows. @@ -168,10 +168,10 @@ typedef struct mdl mdl, ndis_buffer; * typedef ULONG_PTR KSPIN_LOCK; * * From basetsd.h (SDK, Feb. 2003): - * typedef [public] unsigned __int3264 ULONG_PTR, *PULONG_PTR; - * typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; - * typedef _W64 unsigned long ULONG_PTR, *PULONG_PTR; - * + * typedef [public] unsigned __int3264 ULONG_PTR, *PULONG_PTR; + * typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; + * typedef _W64 unsigned long ULONG_PTR, *PULONG_PTR; + * * The keyword __int3264 specifies an integral type that has the following * properties: * + It is 32-bit on 32-bit platforms @@ -203,19 +203,19 @@ union slist_header { typedef union slist_header slist_header; struct list_entry { - struct list_entry *nle_flink; - struct list_entry *nle_blink; + struct list_entry *nle_flink; + struct list_entry *nle_blink; }; typedef struct list_entry list_entry; -#define InitializeListHead(l) \ +#define InitializeListHead(l) \ (l)->nle_flink = (l)->nle_blink = (l) -#define IsListEmpty(h) \ +#define IsListEmpty(h) \ ((h)->nle_flink == (h)) -#define RemoveEntryList(e) \ +#define RemoveEntryList(e) \ do { \ list_entry *b; \ list_entry *f; \ @@ -256,7 +256,7 @@ RemoveTailList(list_entry *l) return (e); } -#define InsertTailList(l, e) \ +#define InsertTailList(l, e) \ do { \ list_entry *b; \ \ @@ -267,7 +267,7 @@ RemoveTailList(list_entry *l) l->nle_blink = (e); \ } while (0) -#define InsertHeadList(l, e) \ +#define InsertHeadList(l, e) \ do { \ list_entry *f; \ \ @@ -278,7 +278,7 @@ RemoveTailList(list_entry *l) l->nle_flink = e; \ } while (0) -#define CONTAINING_RECORD(addr, type, field) \ +#define CONTAINING_RECORD(addr, type, field) \ ((type *)((vm_offset_t)(addr) - (vm_offset_t)(&((type *)0)->field))) struct nt_dispatch_header { @@ -294,48 +294,48 @@ typedef struct nt_dispatch_header nt_dispatch_header; /* Dispatcher object types */ -#define DISP_TYPE_NOTIFICATION_EVENT 0 /* KEVENT */ -#define DISP_TYPE_SYNCHRONIZATION_EVENT 1 /* KEVENT */ -#define DISP_TYPE_MUTANT 2 /* KMUTANT/KMUTEX */ -#define DISP_TYPE_PROCESS 3 /* KPROCESS */ -#define DISP_TYPE_QUEUE 4 /* KQUEUE */ -#define DISP_TYPE_SEMAPHORE 5 /* KSEMAPHORE */ -#define DISP_TYPE_THREAD 6 /* KTHREAD */ -#define DISP_TYPE_NOTIFICATION_TIMER 8 /* KTIMER */ -#define DISP_TYPE_SYNCHRONIZATION_TIMER 9 /* KTIMER */ +#define DISP_TYPE_NOTIFICATION_EVENT 0 /* KEVENT */ +#define DISP_TYPE_SYNCHRONIZATION_EVENT 1 /* KEVENT */ +#define DISP_TYPE_MUTANT 2 /* KMUTANT/KMUTEX */ +#define DISP_TYPE_PROCESS 3 /* KPROCESS */ +#define DISP_TYPE_QUEUE 4 /* KQUEUE */ +#define DISP_TYPE_SEMAPHORE 5 /* KSEMAPHORE */ +#define DISP_TYPE_THREAD 6 /* KTHREAD */ +#define DISP_TYPE_NOTIFICATION_TIMER 8 /* KTIMER */ +#define DISP_TYPE_SYNCHRONIZATION_TIMER 9 /* KTIMER */ -#define OTYPE_EVENT 0 -#define OTYPE_MUTEX 1 -#define OTYPE_THREAD 2 -#define OTYPE_TIMER 3 +#define OTYPE_EVENT 0 +#define OTYPE_MUTEX 1 +#define OTYPE_THREAD 2 +#define OTYPE_TIMER 3 /* Windows dispatcher levels. */ -#define PASSIVE_LEVEL 0 -#define LOW_LEVEL 0 -#define APC_LEVEL 1 -#define DISPATCH_LEVEL 2 -#define DEVICE_LEVEL (DISPATCH_LEVEL + 1) -#define PROFILE_LEVEL 27 -#define CLOCK1_LEVEL 28 -#define CLOCK2_LEVEL 28 -#define IPI_LEVEL 29 -#define POWER_LEVEL 30 -#define HIGH_LEVEL 31 +#define PASSIVE_LEVEL 0 +#define LOW_LEVEL 0 +#define APC_LEVEL 1 +#define DISPATCH_LEVEL 2 +#define DEVICE_LEVEL (DISPATCH_LEVEL + 1) +#define PROFILE_LEVEL 27 +#define CLOCK1_LEVEL 28 +#define CLOCK2_LEVEL 28 +#define IPI_LEVEL 29 +#define POWER_LEVEL 30 +#define HIGH_LEVEL 31 -#define SYNC_LEVEL_UP DISPATCH_LEVEL -#define SYNC_LEVEL_MP (IPI_LEVEL - 1) +#define SYNC_LEVEL_UP DISPATCH_LEVEL +#define SYNC_LEVEL_MP (IPI_LEVEL - 1) -#define AT_PASSIVE_LEVEL(td) \ +#define AT_PASSIVE_LEVEL(td) \ ((td)->td_proc->p_flag & P_KTHREAD == FALSE) -#define AT_DISPATCH_LEVEL(td) \ +#define AT_DISPATCH_LEVEL(td) \ ((td)->td_base_pri == PI_REALTIME) -#define AT_DIRQL_LEVEL(td) \ +#define AT_DIRQL_LEVEL(td) \ ((td)->td_priority <= PI_NET) -#define AT_HIGH_LEVEL(td) \ +#define AT_HIGH_LEVEL(td) \ ((td)->td_critnest != 0) struct nt_objref { @@ -348,8 +348,8 @@ TAILQ_HEAD(nt_objref_head, nt_objref); typedef struct nt_objref nt_objref; -#define EVENT_TYPE_NOTIFY 0 -#define EVENT_TYPE_SYNC 1 +#define EVENT_TYPE_NOTIFY 0 +#define EVENT_TYPE_SYNC 1 /* * We need to use the timeout()/untimeout() API for ktimers @@ -375,8 +375,8 @@ struct ktimer { uint32_t k_period; }; -#define k_timerlistentry u.k_timerlistentry -#define k_callout u.k_callout +#define k_timerlistentry u.k_timerlistentry +#define k_callout u.k_callout typedef struct ktimer ktimer; @@ -403,11 +403,11 @@ struct kdpc { void *k_lock; }; -#define KDPC_IMPORTANCE_LOW 0 -#define KDPC_IMPORTANCE_MEDIUM 1 -#define KDPC_IMPORTANCE_HIGH 2 +#define KDPC_IMPORTANCE_LOW 0 +#define KDPC_IMPORTANCE_MEDIUM 1 +#define KDPC_IMPORTANCE_HIGH 2 -#define KDPC_CPU_DEFAULT 255 +#define KDPC_CPU_DEFAULT 255 typedef struct kdpc kdpc; @@ -432,7 +432,7 @@ struct kmutant { typedef struct kmutant kmutant; -#define LOOKASIDE_DEPTH 256 +#define LOOKASIDE_DEPTH 256 struct general_lookaside { slist_header gl_listhead; @@ -526,15 +526,15 @@ struct wait_block { typedef struct wait_block wait_block; -#define wb_ext wb_kthread +#define wb_ext wb_kthread -#define THREAD_WAIT_OBJECTS 3 -#define MAX_WAIT_OBJECTS 64 +#define THREAD_WAIT_OBJECTS 3 +#define MAX_WAIT_OBJECTS 64 -#define WAITTYPE_ALL 0 -#define WAITTYPE_ANY 1 +#define WAITTYPE_ALL 0 +#define WAITTYPE_ANY 1 -#define WAITKEY_VALID 0x8000 +#define WAITKEY_VALID 0x8000 /* kthread priority */ #define LOW_PRIORITY 0 @@ -654,198 +654,198 @@ typedef struct devobj_extension devobj_extension; /* Device object flags */ -#define DO_VERIFY_VOLUME 0x00000002 -#define DO_BUFFERED_IO 0x00000004 -#define DO_EXCLUSIVE 0x00000008 -#define DO_DIRECT_IO 0x00000010 -#define DO_MAP_IO_BUFFER 0x00000020 -#define DO_DEVICE_HAS_NAME 0x00000040 -#define DO_DEVICE_INITIALIZING 0x00000080 -#define DO_SYSTEM_BOOT_PARTITION 0x00000100 -#define DO_LONG_TERM_REQUESTS 0x00000200 -#define DO_NEVER_LAST_DEVICE 0x00000400 -#define DO_SHUTDOWN_REGISTERED 0x00000800 -#define DO_BUS_ENUMERATED_DEVICE 0x00001000 -#define DO_POWER_PAGABLE 0x00002000 -#define DO_POWER_INRUSH 0x00004000 -#define DO_LOW_PRIORITY_FILESYSTEM 0x00010000 +#define DO_VERIFY_VOLUME 0x00000002 +#define DO_BUFFERED_IO 0x00000004 +#define DO_EXCLUSIVE 0x00000008 +#define DO_DIRECT_IO 0x00000010 +#define DO_MAP_IO_BUFFER 0x00000020 +#define DO_DEVICE_HAS_NAME 0x00000040 +#define DO_DEVICE_INITIALIZING 0x00000080 +#define DO_SYSTEM_BOOT_PARTITION 0x00000100 +#define DO_LONG_TERM_REQUESTS 0x00000200 +#define DO_NEVER_LAST_DEVICE 0x00000400 +#define DO_SHUTDOWN_REGISTERED 0x00000800 +#define DO_BUS_ENUMERATED_DEVICE 0x00001000 +#define DO_POWER_PAGABLE 0x00002000 +#define DO_POWER_INRUSH 0x00004000 +#define DO_LOW_PRIORITY_FILESYSTEM 0x00010000 /* Priority boosts */ -#define IO_NO_INCREMENT 0 -#define IO_CD_ROM_INCREMENT 1 -#define IO_DISK_INCREMENT 1 -#define IO_KEYBOARD_INCREMENT 6 -#define IO_MAILSLOT_INCREMENT 2 -#define IO_MOUSE_INCREMENT 6 -#define IO_NAMED_PIPE_INCREMENT 2 -#define IO_NETWORK_INCREMENT 2 -#define IO_PARALLEL_INCREMENT 1 -#define IO_SERIAL_INCREMENT 2 -#define IO_SOUND_INCREMENT 8 -#define IO_VIDEO_INCREMENT 1 +#define IO_NO_INCREMENT 0 +#define IO_CD_ROM_INCREMENT 1 +#define IO_DISK_INCREMENT 1 +#define IO_KEYBOARD_INCREMENT 6 +#define IO_MAILSLOT_INCREMENT 2 +#define IO_MOUSE_INCREMENT 6 +#define IO_NAMED_PIPE_INCREMENT 2 +#define IO_NETWORK_INCREMENT 2 +#define IO_PARALLEL_INCREMENT 1 +#define IO_SERIAL_INCREMENT 2 +#define IO_SOUND_INCREMENT 8 +#define IO_VIDEO_INCREMENT 1 /* IRP major codes */ -#define IRP_MJ_CREATE 0x00 -#define IRP_MJ_CREATE_NAMED_PIPE 0x01 -#define IRP_MJ_CLOSE 0x02 -#define IRP_MJ_READ 0x03 -#define IRP_MJ_WRITE 0x04 -#define IRP_MJ_QUERY_INFORMATION 0x05 -#define IRP_MJ_SET_INFORMATION 0x06 -#define IRP_MJ_QUERY_EA 0x07 -#define IRP_MJ_SET_EA 0x08 -#define IRP_MJ_FLUSH_BUFFERS 0x09 -#define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a -#define IRP_MJ_SET_VOLUME_INFORMATION 0x0b -#define IRP_MJ_DIRECTORY_CONTROL 0x0c -#define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d -#define IRP_MJ_DEVICE_CONTROL 0x0e -#define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f -#define IRP_MJ_SHUTDOWN 0x10 -#define IRP_MJ_LOCK_CONTROL 0x11 -#define IRP_MJ_CLEANUP 0x12 -#define IRP_MJ_CREATE_MAILSLOT 0x13 -#define IRP_MJ_QUERY_SECURITY 0x14 -#define IRP_MJ_SET_SECURITY 0x15 -#define IRP_MJ_POWER 0x16 -#define IRP_MJ_SYSTEM_CONTROL 0x17 -#define IRP_MJ_DEVICE_CHANGE 0x18 -#define IRP_MJ_QUERY_QUOTA 0x19 -#define IRP_MJ_SET_QUOTA 0x1a -#define IRP_MJ_PNP 0x1b -#define IRP_MJ_PNP_POWER IRP_MJ_PNP // Obsolete.... -#define IRP_MJ_MAXIMUM_FUNCTION 0x1b -#define IRP_MJ_SCSI IRP_MJ_INTERNAL_DEVICE_CONTROL +#define IRP_MJ_CREATE 0x00 +#define IRP_MJ_CREATE_NAMED_PIPE 0x01 +#define IRP_MJ_CLOSE 0x02 +#define IRP_MJ_READ 0x03 +#define IRP_MJ_WRITE 0x04 +#define IRP_MJ_QUERY_INFORMATION 0x05 +#define IRP_MJ_SET_INFORMATION 0x06 +#define IRP_MJ_QUERY_EA 0x07 +#define IRP_MJ_SET_EA 0x08 +#define IRP_MJ_FLUSH_BUFFERS 0x09 +#define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a +#define IRP_MJ_SET_VOLUME_INFORMATION 0x0b +#define IRP_MJ_DIRECTORY_CONTROL 0x0c +#define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d +#define IRP_MJ_DEVICE_CONTROL 0x0e +#define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f +#define IRP_MJ_SHUTDOWN 0x10 +#define IRP_MJ_LOCK_CONTROL 0x11 +#define IRP_MJ_CLEANUP 0x12 +#define IRP_MJ_CREATE_MAILSLOT 0x13 +#define IRP_MJ_QUERY_SECURITY 0x14 +#define IRP_MJ_SET_SECURITY 0x15 +#define IRP_MJ_POWER 0x16 +#define IRP_MJ_SYSTEM_CONTROL 0x17 +#define IRP_MJ_DEVICE_CHANGE 0x18 +#define IRP_MJ_QUERY_QUOTA 0x19 +#define IRP_MJ_SET_QUOTA 0x1a +#define IRP_MJ_PNP 0x1b +#define IRP_MJ_PNP_POWER IRP_MJ_PNP // Obsolete.... +#define IRP_MJ_MAXIMUM_FUNCTION 0x1b +#define IRP_MJ_SCSI IRP_MJ_INTERNAL_DEVICE_CONTROL /* IRP minor codes */ -#define IRP_MN_QUERY_DIRECTORY 0x01 -#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 -#define IRP_MN_USER_FS_REQUEST 0x00 +#define IRP_MN_QUERY_DIRECTORY 0x01 +#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 +#define IRP_MN_USER_FS_REQUEST 0x00 -#define IRP_MN_MOUNT_VOLUME 0x01 -#define IRP_MN_VERIFY_VOLUME 0x02 -#define IRP_MN_LOAD_FILE_SYSTEM 0x03 -#define IRP_MN_TRACK_LINK 0x04 -#define IRP_MN_KERNEL_CALL 0x04 +#define IRP_MN_MOUNT_VOLUME 0x01 +#define IRP_MN_VERIFY_VOLUME 0x02 +#define IRP_MN_LOAD_FILE_SYSTEM 0x03 +#define IRP_MN_TRACK_LINK 0x04 +#define IRP_MN_KERNEL_CALL 0x04 -#define IRP_MN_LOCK 0x01 -#define IRP_MN_UNLOCK_SINGLE 0x02 -#define IRP_MN_UNLOCK_ALL 0x03 -#define IRP_MN_UNLOCK_ALL_BY_KEY 0x04 +#define IRP_MN_LOCK 0x01 +#define IRP_MN_UNLOCK_SINGLE 0x02 +#define IRP_MN_UNLOCK_ALL 0x03 +#define IRP_MN_UNLOCK_ALL_BY_KEY 0x04 -#define IRP_MN_NORMAL 0x00 -#define IRP_MN_DPC 0x01 -#define IRP_MN_MDL 0x02 -#define IRP_MN_COMPLETE 0x04 -#define IRP_MN_COMPRESSED 0x08 +#define IRP_MN_NORMAL 0x00 +#define IRP_MN_DPC 0x01 +#define IRP_MN_MDL 0x02 +#define IRP_MN_COMPLETE 0x04 +#define IRP_MN_COMPRESSED 0x08 -#define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC) -#define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL) -#define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC) +#define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC) +#define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL) +#define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC) -#define IRP_MN_SCSI_CLASS 0x01 +#define IRP_MN_SCSI_CLASS 0x01 -#define IRP_MN_START_DEVICE 0x00 -#define IRP_MN_QUERY_REMOVE_DEVICE 0x01 -#define IRP_MN_REMOVE_DEVICE 0x02 -#define IRP_MN_CANCEL_REMOVE_DEVICE 0x03 -#define IRP_MN_STOP_DEVICE 0x04 -#define IRP_MN_QUERY_STOP_DEVICE 0x05 -#define IRP_MN_CANCEL_STOP_DEVICE 0x06 +#define IRP_MN_START_DEVICE 0x00 +#define IRP_MN_QUERY_REMOVE_DEVICE 0x01 +#define IRP_MN_REMOVE_DEVICE 0x02 +#define IRP_MN_CANCEL_REMOVE_DEVICE 0x03 +#define IRP_MN_STOP_DEVICE 0x04 +#define IRP_MN_QUERY_STOP_DEVICE 0x05 +#define IRP_MN_CANCEL_STOP_DEVICE 0x06 -#define IRP_MN_QUERY_DEVICE_RELATIONS 0x07 -#define IRP_MN_QUERY_INTERFACE 0x08 -#define IRP_MN_QUERY_CAPABILITIES 0x09 -#define IRP_MN_QUERY_RESOURCES 0x0A -#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B -#define IRP_MN_QUERY_DEVICE_TEXT 0x0C -#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D +#define IRP_MN_QUERY_DEVICE_RELATIONS 0x07 +#define IRP_MN_QUERY_INTERFACE 0x08 +#define IRP_MN_QUERY_CAPABILITIES 0x09 +#define IRP_MN_QUERY_RESOURCES 0x0A +#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B +#define IRP_MN_QUERY_DEVICE_TEXT 0x0C +#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D -#define IRP_MN_READ_CONFIG 0x0F -#define IRP_MN_WRITE_CONFIG 0x10 -#define IRP_MN_EJECT 0x11 -#define IRP_MN_SET_LOCK 0x12 -#define IRP_MN_QUERY_ID 0x13 -#define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14 -#define IRP_MN_QUERY_BUS_INFORMATION 0x15 -#define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16 -#define IRP_MN_SURPRISE_REMOVAL 0x17 -#define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18 +#define IRP_MN_READ_CONFIG 0x0F +#define IRP_MN_WRITE_CONFIG 0x10 +#define IRP_MN_EJECT 0x11 +#define IRP_MN_SET_LOCK 0x12 +#define IRP_MN_QUERY_ID 0x13 +#define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14 +#define IRP_MN_QUERY_BUS_INFORMATION 0x15 +#define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16 +#define IRP_MN_SURPRISE_REMOVAL 0x17 +#define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18 -#define IRP_MN_WAIT_WAKE 0x00 -#define IRP_MN_POWER_SEQUENCE 0x01 -#define IRP_MN_SET_POWER 0x02 -#define IRP_MN_QUERY_POWER 0x03 +#define IRP_MN_WAIT_WAKE 0x00 +#define IRP_MN_POWER_SEQUENCE 0x01 +#define IRP_MN_SET_POWER 0x02 +#define IRP_MN_QUERY_POWER 0x03 -#define IRP_MN_QUERY_ALL_DATA 0x00 -#define IRP_MN_QUERY_SINGLE_INSTANCE 0x01 -#define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02 -#define IRP_MN_CHANGE_SINGLE_ITEM 0x03 -#define IRP_MN_ENABLE_EVENTS 0x04 -#define IRP_MN_DISABLE_EVENTS 0x05 -#define IRP_MN_ENABLE_COLLECTION 0x06 -#define IRP_MN_DISABLE_COLLECTION 0x07 -#define IRP_MN_REGINFO 0x08 -#define IRP_MN_EXECUTE_METHOD 0x09 -#define IRP_MN_REGINFO_EX 0x0b +#define IRP_MN_QUERY_ALL_DATA 0x00 +#define IRP_MN_QUERY_SINGLE_INSTANCE 0x01 +#define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02 +#define IRP_MN_CHANGE_SINGLE_ITEM 0x03 +#define IRP_MN_ENABLE_EVENTS 0x04 +#define IRP_MN_DISABLE_EVENTS 0x05 +#define IRP_MN_ENABLE_COLLECTION 0x06 +#define IRP_MN_DISABLE_COLLECTION 0x07 +#define IRP_MN_REGINFO 0x08 +#define IRP_MN_EXECUTE_METHOD 0x09 +#define IRP_MN_REGINFO_EX 0x0b /* IRP flags */ -#define IRP_NOCACHE 0x00000001 -#define IRP_PAGING_IO 0x00000002 -#define IRP_MOUNT_COMPLETION 0x00000002 -#define IRP_SYNCHRONOUS_API 0x00000004 -#define IRP_ASSOCIATED_IRP 0x00000008 -#define IRP_BUFFERED_IO 0x00000010 -#define IRP_DEALLOCATE_BUFFER 0x00000020 -#define IRP_INPUT_OPERATION 0x00000040 -#define IRP_SYNCHRONOUS_PAGING_IO 0x00000040 -#define IRP_CREATE_OPERATION 0x00000080 -#define IRP_READ_OPERATION 0x00000100 -#define IRP_WRITE_OPERATION 0x00000200 -#define IRP_CLOSE_OPERATION 0x00000400 -#define IRP_DEFER_IO_COMPLETION 0x00000800 -#define IRP_OB_QUERY_NAME 0x00001000 -#define IRP_HOLD_DEVICE_QUEUE 0x00002000 -#define IRP_RETRY_IO_COMPLETION 0x00004000 -#define IRP_CLASS_CACHE_OPERATION 0x00008000 -#define IRP_SET_USER_EVENT IRP_CLOSE_OPERATION +#define IRP_NOCACHE 0x00000001 +#define IRP_PAGING_IO 0x00000002 +#define IRP_MOUNT_COMPLETION 0x00000002 +#define IRP_SYNCHRONOUS_API 0x00000004 +#define IRP_ASSOCIATED_IRP 0x00000008 +#define IRP_BUFFERED_IO 0x00000010 +#define IRP_DEALLOCATE_BUFFER 0x00000020 +#define IRP_INPUT_OPERATION 0x00000040 +#define IRP_SYNCHRONOUS_PAGING_IO 0x00000040 +#define IRP_CREATE_OPERATION 0x00000080 +#define IRP_READ_OPERATION 0x00000100 +#define IRP_WRITE_OPERATION 0x00000200 +#define IRP_CLOSE_OPERATION 0x00000400 +#define IRP_DEFER_IO_COMPLETION 0x00000800 +#define IRP_OB_QUERY_NAME 0x00001000 +#define IRP_HOLD_DEVICE_QUEUE 0x00002000 +#define IRP_RETRY_IO_COMPLETION 0x00004000 +#define IRP_CLASS_CACHE_OPERATION 0x00008000 +#define IRP_SET_USER_EVENT IRP_CLOSE_OPERATION /* IRP I/O control flags */ -#define IRP_QUOTA_CHARGED 0x01 -#define IRP_ALLOCATED_MUST_SUCCEED 0x02 -#define IRP_ALLOCATED_FIXED_SIZE 0x04 -#define IRP_LOOKASIDE_ALLOCATION 0x08 +#define IRP_QUOTA_CHARGED 0x01 +#define IRP_ALLOCATED_MUST_SUCCEED 0x02 +#define IRP_ALLOCATED_FIXED_SIZE 0x04 +#define IRP_LOOKASIDE_ALLOCATION 0x08 /* I/O method types */ -#define METHOD_BUFFERED 0 -#define METHOD_IN_DIRECT 1 -#define METHOD_OUT_DIRECT 2 -#define METHOD_NEITHER 3 +#define METHOD_BUFFERED 0 +#define METHOD_IN_DIRECT 1 +#define METHOD_OUT_DIRECT 2 +#define METHOD_NEITHER 3 /* File access types */ -#define FILE_ANY_ACCESS 0x0000 -#define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS -#define FILE_READ_ACCESS 0x0001 -#define FILE_WRITE_ACCESS 0x0002 +#define FILE_ANY_ACCESS 0x0000 +#define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS +#define FILE_READ_ACCESS 0x0001 +#define FILE_WRITE_ACCESS 0x0002 /* Recover I/O access method from IOCTL code. */ -#define IO_METHOD(x) ((x) & 0xFFFFFFFC) +#define IO_METHOD(x) ((x) & 0xFFFFFFFC) /* Recover function code from IOCTL code */ -#define IO_FUNC(x) (((x) & 0x7FFC) >> 2) +#define IO_FUNC(x) (((x) & 0x7FFC) >> 2) /* Macro to construct an IOCTL code. */ -#define IOCTL_CODE(dev, func, iomethod, acc) \ +#define IOCTL_CODE(dev, func, iomethod, acc) \ ((dev) << 16) | (acc << 14) | (func << 2) | (iomethod)) @@ -856,8 +856,8 @@ struct io_status_block { } u; register_t isb_info; }; -#define isb_status u.isb_status -#define isb_ptr u.isb_ptr +#define isb_status u.isb_status +#define isb_ptr u.isb_ptr typedef struct io_status_block io_status_block; @@ -936,10 +936,10 @@ typedef struct io_stack_location io_stack_location; /* Stack location control flags */ -#define SL_PENDING_RETURNED 0x01 -#define SL_INVOKE_ON_CANCEL 0x20 -#define SL_INVOKE_ON_SUCCESS 0x40 -#define SL_INVOKE_ON_ERROR 0x80 +#define SL_PENDING_RETURNED 0x01 +#define SL_INVOKE_ON_CANCEL 0x20 +#define SL_INVOKE_ON_SUCCESS 0x40 +#define SL_INVOKE_ON_ERROR 0x80 struct irp { uint16_t irp_type; @@ -980,7 +980,7 @@ struct irp { union { kdevice_qentry irp_dqe; struct { - void *irp_drvctx[4]; + void *irp_drvctx[4]; } s1; } u1; void *irp_thread; @@ -997,7 +997,7 @@ struct irp { union { kapc irp_apc; struct { - void *irp_xfer; + void *irp_ep; void *irp_dev; } irp_usb; } irp_misc; @@ -1005,21 +1005,21 @@ struct irp { } irp_tail; }; -#define irp_csl s2.u2.irp_csl -#define irp_pkttype s2.u2.irp_pkttype +#define irp_csl s2.u2.irp_csl +#define irp_pkttype s2.u2.irp_pkttype #define IRP_NDIS_DEV(irp) (irp)->irp_tail.irp_misc.irp_usb.irp_dev -#define IRP_NDISUSB_XFER(irp) (irp)->irp_tail.irp_misc.irp_usb.irp_xfer +#define IRP_NDISUSB_EP(irp) (irp)->irp_tail.irp_misc.irp_usb.irp_ep typedef struct irp irp; -#define InterlockedExchangePointer(dst, val) \ +#define InterlockedExchangePointer(dst, val) \ (void *)InterlockedExchange((uint32_t *)(dst), (uintptr_t)(val)) -#define IoSizeOfIrp(ssize) \ +#define IoSizeOfIrp(ssize) \ ((uint16_t) (sizeof(irp) + ((ssize) * (sizeof(io_stack_location))))) -#define IoSetCancelRoutine(irp, func) \ +#define IoSetCancelRoutine(irp, func) \ (cancel_func)InterlockedExchangePointer( \ (void *)&(ip)->irp_cancelfunc, (void *)(func)) @@ -1027,19 +1027,19 @@ typedef struct irp irp; (u_long)InterlockedExchangePointer( \ (void *)&(ip)->irp_cancel, (void *)(val)) -#define IoGetCurrentIrpStackLocation(irp) \ +#define IoGetCurrentIrpStackLocation(irp) \ (irp)->irp_tail.irp_overlay.irp_csl -#define IoGetNextIrpStackLocation(irp) \ +#define IoGetNextIrpStackLocation(irp) \ ((irp)->irp_tail.irp_overlay.irp_csl - 1) -#define IoSetNextIrpStackLocation(irp) \ +#define IoSetNextIrpStackLocation(irp) \ do { \ irp->irp_currentstackloc--; \ irp->irp_tail.irp_overlay.irp_csl--; \ } while(0) -#define IoSetCompletionRoutine(irp, func, ctx, ok, err, cancel) \ +#define IoSetCompletionRoutine(irp, func, ctx, ok, err, cancel) \ do { \ io_stack_location *s; \ s = IoGetNextIrpStackLocation((irp)); \ @@ -1051,12 +1051,12 @@ typedef struct irp irp; if (cancel) s->isl_ctl |= SL_INVOKE_ON_CANCEL; \ } while(0) -#define IoMarkIrpPending(irp) \ +#define IoMarkIrpPending(irp) \ IoGetCurrentIrpStackLocation(irp)->isl_ctl |= SL_PENDING_RETURNED #define IoUnmarkIrpPending(irp) \ IoGetCurrentIrpStackLocation(irp)->isl_ctl &= ~SL_PENDING_RETURNED -#define IoCopyCurrentIrpStackLocationToNext(irp) \ +#define IoCopyCurrentIrpStackLocationToNext(irp) \ do { \ io_stack_location *src, *dst; \ src = IoGetCurrentIrpStackLocation(irp); \ @@ -1065,16 +1065,16 @@ typedef struct irp irp; offsetof(io_stack_location, isl_completionfunc)); \ } while(0) -#define IoSkipCurrentIrpStackLocation(irp) \ +#define IoSkipCurrentIrpStackLocation(irp) \ do { \ (irp)->irp_currentstackloc++; \ (irp)->irp_tail.irp_overlay.irp_csl++; \ } while(0) -#define IoInitializeDpcRequest(dobj, dpcfunc) \ +#define IoInitializeDpcRequest(dobj, dpcfunc) \ KeInitializeDpc(&(dobj)->do_dpc, dpcfunc, dobj) -#define IoRequestDpc(dobj, irp, ctx) \ +#define IoRequestDpc(dobj, irp, ctx) \ KeInsertQueueDpc(&(dobj)->do_dpc, irp, ctx) typedef uint32_t (*driver_dispatch)(device_object *, irp *); @@ -1109,136 +1109,136 @@ struct driver_object { typedef struct driver_object driver_object; -#define DEVPROP_DEVICE_DESCRIPTION 0x00000000 -#define DEVPROP_HARDWARE_ID 0x00000001 -#define DEVPROP_COMPATIBLE_IDS 0x00000002 -#define DEVPROP_BOOTCONF 0x00000003 -#define DEVPROP_BOOTCONF_TRANSLATED 0x00000004 -#define DEVPROP_CLASS_NAME 0x00000005 -#define DEVPROP_CLASS_GUID 0x00000006 -#define DEVPROP_DRIVER_KEYNAME 0x00000007 -#define DEVPROP_MANUFACTURER 0x00000008 -#define DEVPROP_FRIENDLYNAME 0x00000009 -#define DEVPROP_LOCATION_INFO 0x0000000A -#define DEVPROP_PHYSDEV_NAME 0x0000000B -#define DEVPROP_BUSTYPE_GUID 0x0000000C -#define DEVPROP_LEGACY_BUSTYPE 0x0000000D -#define DEVPROP_BUS_NUMBER 0x0000000E -#define DEVPROP_ENUMERATOR_NAME 0x0000000F -#define DEVPROP_ADDRESS 0x00000010 -#define DEVPROP_UINUMBER 0x00000011 -#define DEVPROP_INSTALL_STATE 0x00000012 -#define DEVPROP_REMOVAL_POLICY 0x00000013 +#define DEVPROP_DEVICE_DESCRIPTION 0x00000000 +#define DEVPROP_HARDWARE_ID 0x00000001 +#define DEVPROP_COMPATIBLE_IDS 0x00000002 +#define DEVPROP_BOOTCONF 0x00000003 +#define DEVPROP_BOOTCONF_TRANSLATED 0x00000004 +#define DEVPROP_CLASS_NAME 0x00000005 +#define DEVPROP_CLASS_GUID 0x00000006 +#define DEVPROP_DRIVER_KEYNAME 0x00000007 +#define DEVPROP_MANUFACTURER 0x00000008 +#define DEVPROP_FRIENDLYNAME 0x00000009 +#define DEVPROP_LOCATION_INFO 0x0000000A +#define DEVPROP_PHYSDEV_NAME 0x0000000B +#define DEVPROP_BUSTYPE_GUID 0x0000000C +#define DEVPROP_LEGACY_BUSTYPE 0x0000000D +#define DEVPROP_BUS_NUMBER 0x0000000E +#define DEVPROP_ENUMERATOR_NAME 0x0000000F +#define DEVPROP_ADDRESS 0x00000010 +#define DEVPROP_UINUMBER 0x00000011 +#define DEVPROP_INSTALL_STATE 0x00000012 +#define DEVPROP_REMOVAL_POLICY 0x00000013 /* Various supported device types (used with IoCreateDevice()) */ -#define FILE_DEVICE_BEEP 0x00000001 -#define FILE_DEVICE_CD_ROM 0x00000002 -#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 -#define FILE_DEVICE_CONTROLLER 0x00000004 -#define FILE_DEVICE_DATALINK 0x00000005 -#define FILE_DEVICE_DFS 0x00000006 -#define FILE_DEVICE_DISK 0x00000007 -#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 -#define FILE_DEVICE_FILE_SYSTEM 0x00000009 -#define FILE_DEVICE_INPORT_PORT 0x0000000A -#define FILE_DEVICE_KEYBOARD 0x0000000B -#define FILE_DEVICE_MAILSLOT 0x0000000C -#define FILE_DEVICE_MIDI_IN 0x0000000D -#define FILE_DEVICE_MIDI_OUT 0x0000000E -#define FILE_DEVICE_MOUSE 0x0000000F -#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 -#define FILE_DEVICE_NAMED_PIPE 0x00000011 -#define FILE_DEVICE_NETWORK 0x00000012 -#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 -#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 -#define FILE_DEVICE_NULL 0x00000015 -#define FILE_DEVICE_PARALLEL_PORT 0x00000016 -#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 -#define FILE_DEVICE_PRINTER 0x00000018 -#define FILE_DEVICE_SCANNER 0x00000019 -#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001A -#define FILE_DEVICE_SERIAL_PORT 0x0000001B -#define FILE_DEVICE_SCREEN 0x0000001C -#define FILE_DEVICE_SOUND 0x0000001D -#define FILE_DEVICE_STREAMS 0x0000001E -#define FILE_DEVICE_TAPE 0x0000001F -#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 -#define FILE_DEVICE_TRANSPORT 0x00000021 -#define FILE_DEVICE_UNKNOWN 0x00000022 -#define FILE_DEVICE_VIDEO 0x00000023 -#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 -#define FILE_DEVICE_WAVE_IN 0x00000025 -#define FILE_DEVICE_WAVE_OUT 0x00000026 -#define FILE_DEVICE_8042_PORT 0x00000027 -#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 -#define FILE_DEVICE_BATTERY 0x00000029 -#define FILE_DEVICE_BUS_EXTENDER 0x0000002A -#define FILE_DEVICE_MODEM 0x0000002B -#define FILE_DEVICE_VDM 0x0000002C -#define FILE_DEVICE_MASS_STORAGE 0x0000002D -#define FILE_DEVICE_SMB 0x0000002E -#define FILE_DEVICE_KS 0x0000002F -#define FILE_DEVICE_CHANGER 0x00000030 -#define FILE_DEVICE_SMARTCARD 0x00000031 -#define FILE_DEVICE_ACPI 0x00000032 -#define FILE_DEVICE_DVD 0x00000033 -#define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034 -#define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035 -#define FILE_DEVICE_DFS_VOLUME 0x00000036 -#define FILE_DEVICE_SERENUM 0x00000037 -#define FILE_DEVICE_TERMSRV 0x00000038 -#define FILE_DEVICE_KSEC 0x00000039 -#define FILE_DEVICE_FIPS 0x0000003A +#define FILE_DEVICE_BEEP 0x00000001 +#define FILE_DEVICE_CD_ROM 0x00000002 +#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 +#define FILE_DEVICE_CONTROLLER 0x00000004 +#define FILE_DEVICE_DATALINK 0x00000005 +#define FILE_DEVICE_DFS 0x00000006 +#define FILE_DEVICE_DISK 0x00000007 +#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 +#define FILE_DEVICE_FILE_SYSTEM 0x00000009 +#define FILE_DEVICE_INPORT_PORT 0x0000000A +#define FILE_DEVICE_KEYBOARD 0x0000000B +#define FILE_DEVICE_MAILSLOT 0x0000000C +#define FILE_DEVICE_MIDI_IN 0x0000000D +#define FILE_DEVICE_MIDI_OUT 0x0000000E +#define FILE_DEVICE_MOUSE 0x0000000F +#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010 +#define FILE_DEVICE_NAMED_PIPE 0x00000011 +#define FILE_DEVICE_NETWORK 0x00000012 +#define FILE_DEVICE_NETWORK_BROWSER 0x00000013 +#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 +#define FILE_DEVICE_NULL 0x00000015 +#define FILE_DEVICE_PARALLEL_PORT 0x00000016 +#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017 +#define FILE_DEVICE_PRINTER 0x00000018 +#define FILE_DEVICE_SCANNER 0x00000019 +#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001A +#define FILE_DEVICE_SERIAL_PORT 0x0000001B +#define FILE_DEVICE_SCREEN 0x0000001C +#define FILE_DEVICE_SOUND 0x0000001D +#define FILE_DEVICE_STREAMS 0x0000001E +#define FILE_DEVICE_TAPE 0x0000001F +#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 +#define FILE_DEVICE_TRANSPORT 0x00000021 +#define FILE_DEVICE_UNKNOWN 0x00000022 +#define FILE_DEVICE_VIDEO 0x00000023 +#define FILE_DEVICE_VIRTUAL_DISK 0x00000024 +#define FILE_DEVICE_WAVE_IN 0x00000025 +#define FILE_DEVICE_WAVE_OUT 0x00000026 +#define FILE_DEVICE_8042_PORT 0x00000027 +#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 +#define FILE_DEVICE_BATTERY 0x00000029 +#define FILE_DEVICE_BUS_EXTENDER 0x0000002A +#define FILE_DEVICE_MODEM 0x0000002B +#define FILE_DEVICE_VDM 0x0000002C +#define FILE_DEVICE_MASS_STORAGE 0x0000002D +#define FILE_DEVICE_SMB 0x0000002E +#define FILE_DEVICE_KS 0x0000002F +#define FILE_DEVICE_CHANGER 0x00000030 +#define FILE_DEVICE_SMARTCARD 0x00000031 +#define FILE_DEVICE_ACPI 0x00000032 +#define FILE_DEVICE_DVD 0x00000033 +#define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034 +#define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035 +#define FILE_DEVICE_DFS_VOLUME 0x00000036 +#define FILE_DEVICE_SERENUM 0x00000037 +#define FILE_DEVICE_TERMSRV 0x00000038 +#define FILE_DEVICE_KSEC 0x00000039 +#define FILE_DEVICE_FIPS 0x0000003A /* Device characteristics */ -#define FILE_REMOVABLE_MEDIA 0x00000001 -#define FILE_READ_ONLY_DEVICE 0x00000002 -#define FILE_FLOPPY_DISKETTE 0x00000004 -#define FILE_WRITE_ONCE_MEDIA 0x00000008 -#define FILE_REMOTE_DEVICE 0x00000010 -#define FILE_DEVICE_IS_MOUNTED 0x00000020 -#define FILE_VIRTUAL_VOLUME 0x00000040 -#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080 -#define FILE_DEVICE_SECURE_OPEN 0x00000100 +#define FILE_REMOVABLE_MEDIA 0x00000001 +#define FILE_READ_ONLY_DEVICE 0x00000002 +#define FILE_FLOPPY_DISKETTE 0x00000004 +#define FILE_WRITE_ONCE_MEDIA 0x00000008 +#define FILE_REMOTE_DEVICE 0x00000010 +#define FILE_DEVICE_IS_MOUNTED 0x00000020 +#define FILE_VIRTUAL_VOLUME 0x00000040 +#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080 +#define FILE_DEVICE_SECURE_OPEN 0x00000100 /* Status codes */ -#define STATUS_SUCCESS 0x00000000 -#define STATUS_USER_APC 0x000000C0 -#define STATUS_KERNEL_APC 0x00000100 -#define STATUS_ALERTED 0x00000101 -#define STATUS_TIMEOUT 0x00000102 -#define STATUS_PENDING 0x00000103 +#define STATUS_SUCCESS 0x00000000 +#define STATUS_USER_APC 0x000000C0 +#define STATUS_KERNEL_APC 0x00000100 +#define STATUS_ALERTED 0x00000101 +#define STATUS_TIMEOUT 0x00000102 +#define STATUS_PENDING 0x00000103 #define STATUS_FAILURE 0xC0000001 #define STATUS_NOT_IMPLEMENTED 0xC0000002 -#define STATUS_INVALID_PARAMETER 0xC000000D -#define STATUS_INVALID_DEVICE_REQUEST 0xC0000010 -#define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016 +#define STATUS_INVALID_PARAMETER 0xC000000D +#define STATUS_INVALID_DEVICE_REQUEST 0xC0000010 +#define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016 #define STATUS_NO_MEMORY 0xC0000017 -#define STATUS_BUFFER_TOO_SMALL 0xC0000023 -#define STATUS_MUTANT_NOT_OWNED 0xC0000046 +#define STATUS_BUFFER_TOO_SMALL 0xC0000023 +#define STATUS_MUTANT_NOT_OWNED 0xC0000046 #define STATUS_NOT_SUPPORTED 0xC00000BB -#define STATUS_INVALID_PARAMETER_2 0xC00000F0 -#define STATUS_INSUFFICIENT_RESOURCES 0xC000009A +#define STATUS_INVALID_PARAMETER_2 0xC00000F0 +#define STATUS_INSUFFICIENT_RESOURCES 0xC000009A #define STATUS_DEVICE_NOT_CONNECTED 0xC000009D #define STATUS_CANCELLED 0xC0000120 -#define STATUS_NOT_FOUND 0xC0000225 +#define STATUS_NOT_FOUND 0xC0000225 #define STATUS_DEVICE_REMOVED 0xC00002B6 -#define STATUS_WAIT_0 0x00000000 +#define STATUS_WAIT_0 0x00000000 /* Memory pool types, for ExAllocatePoolWithTag() */ -#define NonPagedPool 0x00000000 -#define PagedPool 0x00000001 -#define NonPagedPoolMustSucceed 0x00000002 -#define DontUseThisType 0x00000003 -#define NonPagedPoolCacheAligned 0x00000004 -#define PagedPoolCacheAligned 0x00000005 -#define NonPagedPoolCacheAlignedMustS 0x00000006 -#define MaxPoolType 0x00000007 +#define NonPagedPool 0x00000000 +#define PagedPool 0x00000001 +#define NonPagedPoolMustSucceed 0x00000002 +#define DontUseThisType 0x00000003 +#define NonPagedPoolCacheAligned 0x00000004 +#define PagedPoolCacheAligned 0x00000005 +#define NonPagedPoolCacheAlignedMustS 0x00000006 +#define MaxPoolType 0x00000007 /* * IO_WORKITEM is an opaque structures that must be allocated @@ -1257,13 +1257,13 @@ struct io_workitem { typedef struct io_workitem io_workitem; -#define WORKQUEUE_CRITICAL 0 -#define WORKQUEUE_DELAYED 1 -#define WORKQUEUE_HYPERCRITICAL 2 +#define WORKQUEUE_CRITICAL 0 +#define WORKQUEUE_DELAYED 1 +#define WORKQUEUE_HYPERCRITICAL 2 -#define WORKITEM_THREADS 4 -#define WORKITEM_LEGACY_THREAD 3 -#define WORKIDX_INC(x) (x) = (x + 1) % WORKITEM_LEGACY_THREAD +#define WORKITEM_THREADS 4 +#define WORKITEM_LEGACY_THREAD 3 +#define WORKIDX_INC(x) (x) = (x + 1) % WORKITEM_LEGACY_THREAD /* * Older, deprecated work item API, needed to support NdisQueueWorkItem(). @@ -1281,7 +1281,7 @@ struct work_queue_item { typedef struct work_queue_item work_queue_item; -#define ExInitializeWorkItem(w, func, ctx) \ +#define ExInitializeWorkItem(w, func, ctx) \ do { \ (w)->wqi_func = (func); \ (w)->wqi_ctx = (ctx); \ @@ -1293,17 +1293,17 @@ typedef struct work_queue_item work_queue_item; * Windows stack is larger, so we need to give our threads more * stack pages. 4 should be enough, we use 8 just to extra safe. */ -#define NDIS_KSTACK_PAGES 8 +#define NDIS_KSTACK_PAGES 8 /* * Different kinds of function wrapping we can do. */ -#define WINDRV_WRAP_STDCALL 1 -#define WINDRV_WRAP_FASTCALL 2 -#define WINDRV_WRAP_REGPARM 3 -#define WINDRV_WRAP_CDECL 4 -#define WINDRV_WRAP_AMD64 5 +#define WINDRV_WRAP_STDCALL 1 +#define WINDRV_WRAP_FASTCALL 2 +#define WINDRV_WRAP_REGPARM 3 +#define WINDRV_WRAP_CDECL 4 +#define WINDRV_WRAP_AMD64 5 struct drvdb_ent { driver_object *windrv_object; @@ -1362,7 +1362,7 @@ extern void KeFlushQueuedDpcs(void); extern uint32_t KeGetCurrentProcessorNumber(void); extern void KeInitializeTimer(ktimer *); extern void KeInitializeTimerEx(ktimer *, uint32_t); -extern uint8_t KeSetTimer(ktimer *, int64_t, kdpc *); +extern uint8_t KeSetTimer(ktimer *, int64_t, kdpc *); extern uint8_t KeSetTimerEx(ktimer *, int64_t, uint32_t, kdpc *); extern uint8_t KeCancelTimer(ktimer *); extern uint8_t KeReadStateTimer(ktimer *); @@ -1420,32 +1420,32 @@ extern void IoFreeWorkItem(io_workitem *); extern void IoQueueWorkItem(io_workitem *, io_workitem_func, uint32_t, void *); -#define IoCallDriver(a, b) IofCallDriver(a, b) -#define IoCompleteRequest(a, b) IofCompleteRequest(a, b) +#define IoCallDriver(a, b) IofCallDriver(a, b) +#define IoCompleteRequest(a, b) IofCompleteRequest(a, b) /* * On the Windows x86 arch, KeAcquireSpinLock() and KeReleaseSpinLock() * routines live in the HAL. We try to imitate this behavior. */ #ifdef __i386__ -#define KeAcquireSpinLock(a, b) *(b) = KfAcquireSpinLock(a) -#define KeReleaseSpinLock(a, b) KfReleaseSpinLock(a, b) -#define KeRaiseIrql(a, b) *(b) = KfRaiseIrql(a) -#define KeLowerIrql(a) KfLowerIrql(a) -#define KeAcquireSpinLockAtDpcLevel(a) KefAcquireSpinLockAtDpcLevel(a) -#define KeReleaseSpinLockFromDpcLevel(a) KefReleaseSpinLockFromDpcLevel(a) +#define KeAcquireSpinLock(a, b) *(b) = KfAcquireSpinLock(a) +#define KeReleaseSpinLock(a, b) KfReleaseSpinLock(a, b) +#define KeRaiseIrql(a, b) *(b) = KfRaiseIrql(a) +#define KeLowerIrql(a) KfLowerIrql(a) +#define KeAcquireSpinLockAtDpcLevel(a) KefAcquireSpinLockAtDpcLevel(a) +#define KeReleaseSpinLockFromDpcLevel(a) KefReleaseSpinLockFromDpcLevel(a) #endif /* __i386__ */ #ifdef __amd64__ -#define KeAcquireSpinLock(a, b) *(b) = KfAcquireSpinLock(a) -#define KeReleaseSpinLock(a, b) KfReleaseSpinLock(a, b) +#define KeAcquireSpinLock(a, b) *(b) = KfAcquireSpinLock(a) +#define KeReleaseSpinLock(a, b) KfReleaseSpinLock(a, b) /* * These may need to be redefined later; * not sure where they live on amd64 yet. */ -#define KeRaiseIrql(a, b) *(b) = KfRaiseIrql(a) -#define KeLowerIrql(a) KfLowerIrql(a) +#define KeRaiseIrql(a, b) *(b) = KfRaiseIrql(a) +#define KeLowerIrql(a) KfLowerIrql(a) #endif /* __amd64__ */ __END_DECLS diff --git a/sys/compat/ndis/pe_var.h b/sys/compat/ndis/pe_var.h index e778b5805532..84e016251128 100644 --- a/sys/compat/ndis/pe_var.h +++ b/sys/compat/ndis/pe_var.h @@ -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__ */ diff --git a/sys/compat/ndis/resource_var.h b/sys/compat/ndis/resource_var.h index 28f2d62920ee..5ce096c08e02 100644 --- a/sys/compat/ndis/resource_var.h +++ b/sys/compat/ndis/resource_var.h @@ -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; diff --git a/sys/compat/ndis/subr_hal.c b/sys/compat/ndis/subr_hal.c index be05215f90f2..6af9a2b4e384 100644 --- a/sys/compat/ndis/subr_hal.c +++ b/sys/compat/ndis/subr_hal.c @@ -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) diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c index 2aeb7ee20fac..f67401347cbb 100644 --- a/sys/compat/ndis/subr_ndis.c +++ b/sys/compat/ndis/subr_ndis.c @@ -95,8 +95,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include #include #include @@ -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), diff --git a/sys/compat/ndis/subr_ntoskrnl.c b/sys/compat/ndis/subr_ntoskrnl.c index b2c12318d8ef..237da312319b 100644 --- a/sys/compat/ndis/subr_ntoskrnl.c +++ b/sys/compat/ndis/subr_ntoskrnl.c @@ -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), diff --git a/sys/compat/ndis/subr_pe.c b/sys/compat/ndis/subr_pe.c index 1235ab0549af..6a347a427eb2 100644 --- a/sys/compat/ndis/subr_pe.c +++ b/sys/compat/ndis/subr_pe.c @@ -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; diff --git a/sys/compat/ndis/subr_usbd.c b/sys/compat/ndis/subr_usbd.c index 568ad359e566..11f5a59cb923 100644 --- a/sys/compat/ndis/subr_usbd.c +++ b/sys/compat/ndis/subr_usbd.c @@ -56,12 +56,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include -#include -#include "usbdevs.h" +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -73,29 +75,24 @@ __FBSDID("$FreeBSD$"); #include static driver_object usbd_driver; +static usb2_callback_t usbd_non_isoc_callback; static int32_t usbd_func_bulkintr(irp *); static int32_t usbd_func_vendorclass(irp *); static int32_t usbd_func_selconf(irp *); +static int32_t usbd_func_abort_pipe(irp *); +static usb2_error_t usbd_setup_endpoint(irp *, uint8_t, + struct usb2_endpoint_descriptor *); static int32_t usbd_func_getdesc(irp *); -static usbd_status usbd_get_desc_ndis(usbd_device_handle, int, int, int, - void *, int *); static union usbd_urb *usbd_geturb(irp *); -static usbd_status usbd_init_ndispipe(irp *, usb_endpoint_descriptor_t *); -static usbd_xfer_handle usbd_init_ndisxfer(irp *, usb_endpoint_descriptor_t *, - void *, uint32_t); +static struct ndisusb_ep*usbd_get_ndisep(irp *, usb_endpoint_descriptor_t *); static int32_t usbd_iodispatch(device_object *, irp *); static int32_t usbd_ioinvalid(device_object *, irp *); static int32_t usbd_pnp(device_object *, irp *); static int32_t usbd_power(device_object *, irp *); static void usbd_irpcancel(device_object *, irp *); -static void usbd_irpcancel_cb(void *); static int32_t usbd_submit_urb(irp *); static int32_t usbd_urb2nt(int32_t); -static void usbd_xfereof(usbd_xfer_handle, usbd_private_handle, - usbd_status); -static void usbd_xferadd(usbd_xfer_handle, usbd_private_handle, - usbd_status); static void usbd_xfertask(device_object *, void *); static void dummy(void); @@ -156,7 +153,7 @@ usbd_libinit(void) /* Set up our dipatch routine. */ for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) - usbd_driver.dro_dispatch[i] = + usbd_driver.dro_dispatch[i] = (driver_dispatch)usbd_ioinvalid_wrap; usbd_driver.dro_dispatch[IRP_MJ_INTERNAL_DEVICE_CONTROL] = @@ -314,36 +311,36 @@ usbd_urb2nt(status) return (STATUS_FAILURE); } -/* Convert FreeBSD's usbd_status to USBD_STATUS */ +/* Convert FreeBSD's usb2_error_t to USBD_STATUS */ static int32_t usbd_usb2urb(int status) { switch (status) { - case USBD_NORMAL_COMPLETION: + case USB_ERR_NORMAL_COMPLETION: return (USBD_STATUS_SUCCESS); - case USBD_IN_PROGRESS: + case USB_ERR_PENDING_REQUESTS: return (USBD_STATUS_PENDING); - case USBD_TIMEOUT: + case USB_ERR_TIMEOUT: return (USBD_STATUS_TIMEOUT); - case USBD_SHORT_XFER: + case USB_ERR_SHORT_XFER: return (USBD_STATUS_ERROR_SHORT_TRANSFER); - case USBD_IOERROR: + case USB_ERR_IOERROR: return (USBD_STATUS_XACT_ERROR); - case USBD_NOMEM: + case USB_ERR_NOMEM: return (USBD_STATUS_NO_MEMORY); - case USBD_INVAL: + case USB_ERR_INVAL: return (USBD_STATUS_REQUEST_FAILED); - case USBD_NOT_STARTED: - case USBD_TOO_DEEP: - case USBD_NO_POWER: + case USB_ERR_NOT_STARTED: + case USB_ERR_TOO_DEEP: + case USB_ERR_NO_POWER: return (USBD_STATUS_DEVICE_GONE); - case USBD_CANCELLED: + case USB_ERR_CANCELLED: return (USBD_STATUS_CANCELED); default: break; } - + return (USBD_STATUS_NOT_SUPPORTED); } @@ -394,6 +391,10 @@ usbd_submit_urb(ip) status = usbd_func_selconf(ip); USBD_URB_STATUS(urb) = status; break; + case URB_FUNCTION_ABORT_PIPE: + status = usbd_func_abort_pipe(ip); + USBD_URB_STATUS(urb) = status; + break; case URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE: status = usbd_func_getdesc(ip); USBD_URB_STATUS(urb) = status; @@ -412,99 +413,62 @@ static int32_t usbd_func_getdesc(ip) irp *ip; { +#define NDISUSB_GETDESC_MAXRETRIES 3 device_t dev = IRP_NDIS_DEV(ip); - int actlen, i; - struct usb_attach_arg *uaa = device_get_ivars(dev); + struct ndis_softc *sc = device_get_softc(dev); struct usbd_urb_control_descriptor_request *ctldesc; + uint8_t irql; + uint16_t actlen; uint32_t len; union usbd_urb *urb; - usb_config_descriptor_t cd, *cdp; - usbd_status status; - - mtx_lock(&Giant); + usb_config_descriptor_t *cdp; + usb2_error_t status; urb = usbd_geturb(ip); ctldesc = &urb->uu_ctldesc; if (ctldesc->ucd_desctype == UDESC_CONFIG) { - /* Get the short config descriptor. */ - status = usbd_get_config_desc(uaa->device, ctldesc->ucd_idx, - &cd); - if (status != USBD_NORMAL_COMPLETION) { - ctldesc->ucd_trans_buflen = 0; - mtx_unlock(&Giant); - return usbd_usb2urb(status); + /* + * The NDIS driver is not allowed to change the + * config! There is only one choice! + */ + cdp = usb2_get_config_descriptor(sc->ndisusb_dev); + if (cdp == NULL) { + status = USB_ERR_INVAL; + goto exit; } - /* Get the full descriptor. Try a few times for slow devices. */ - len = MIN(ctldesc->ucd_trans_buflen, UGETW(cd.wTotalLength)); - for (i = 0; i < 3; i++) { - status = usbd_get_desc_ndis(uaa->device, - ctldesc->ucd_desctype, ctldesc->ucd_idx, - len, ctldesc->ucd_trans_buf, &actlen); - if (status == USBD_NORMAL_COMPLETION) - break; - usbd_delay_ms(uaa->device, 200); - } - if (status != USBD_NORMAL_COMPLETION) { - ctldesc->ucd_trans_buflen = 0; - mtx_unlock(&Giant); - return usbd_usb2urb(status); - } - - cdp = (usb_config_descriptor_t *)ctldesc->ucd_trans_buf; if (cdp->bDescriptorType != UDESC_CONFIG) { device_printf(dev, "bad desc %d\n", cdp->bDescriptorType); - status = USBD_INVAL; + status = USB_ERR_INVAL; + goto exit; } - } else if (ctldesc->ucd_desctype == UDESC_STRING) { - /* Try a few times for slow devices. */ - for (i = 0; i < 3; i++) { - status = usbd_get_string_desc(uaa->device, - (UDESC_STRING << 8) + ctldesc->ucd_idx, - ctldesc->ucd_langid, ctldesc->ucd_trans_buf, - &actlen); - if (actlen > ctldesc->ucd_trans_buflen) - panic("small string buffer for UDESC_STRING"); - if (status == USBD_NORMAL_COMPLETION) - break; - usbd_delay_ms(uaa->device, 200); - } - } else - status = usbd_get_desc_ndis(uaa->device, ctldesc->ucd_desctype, - ctldesc->ucd_idx, ctldesc->ucd_trans_buflen, - ctldesc->ucd_trans_buf, &actlen); - - if (status != USBD_NORMAL_COMPLETION) { + /* get minimum length */ + len = MIN(UGETW(cdp->wTotalLength), ctldesc->ucd_trans_buflen); + /* copy out config descriptor */ + memcpy(ctldesc->ucd_trans_buf, cdp, len); + /* set actual length */ + actlen = len; + status = USB_ERR_NORMAL_COMPLETION; + } else { + KeRaiseIrql(DISPATCH_LEVEL, &irql); + status = usb2_req_get_desc(sc->ndisusb_dev, hal_getdisplock(), + &actlen, ctldesc->ucd_trans_buf, 2, + ctldesc->ucd_trans_buflen, ctldesc->ucd_langid, + ctldesc->ucd_desctype, ctldesc->ucd_idx, + NDISUSB_GETDESC_MAXRETRIES); + KeLowerIrql(irql); + } +exit: + if (status != USB_ERR_NORMAL_COMPLETION) { ctldesc->ucd_trans_buflen = 0; - mtx_unlock(&Giant); return usbd_usb2urb(status); } ctldesc->ucd_trans_buflen = actlen; ip->irp_iostat.isb_info = actlen; - mtx_unlock(&Giant); - return (USBD_STATUS_SUCCESS); -} - -/* - * FIXME: at USB1, not USB2, framework, there's no a interface to get `actlen'. - * However, we need it!!! - */ -static usbd_status -usbd_get_desc_ndis(usbd_device_handle dev, int type, int index, int len, - void *desc, int *actlen) -{ - usb_device_request_t req; - - req.bmRequestType = UT_READ_DEVICE; - req.bRequest = UR_GET_DESCRIPTOR; - USETW2(req.wValue, type, index); - USETW(req.wIndex, 0); - USETW(req.wLength, len); - return usbd_do_request_flags_pipe(dev, dev->default_pipe, &req, desc, - 0, actlen, USBD_DEFAULT_TIMEOUT); +#undef NDISUSB_GETDESC_MAXRETRIES } static int32_t @@ -513,16 +477,16 @@ usbd_func_selconf(ip) { device_t dev = IRP_NDIS_DEV(ip); int i, j; - struct usb_attach_arg *uaa = device_get_ivars(dev); + struct ndis_softc *sc = device_get_softc(dev); + struct usb2_device *udev = sc->ndisusb_dev; + struct usb2_pipe *p = NULL; struct usbd_interface_information *intf; struct usbd_pipe_information *pipe; struct usbd_urb_select_configuration *selconf; union usbd_urb *urb; usb_config_descriptor_t *conf; usb_endpoint_descriptor_t *edesc; - usbd_device_handle udev = uaa->device; - usbd_interface_handle iface; - usbd_status ret; + usb2_error_t ret; urb = usbd_geturb(ip); @@ -530,44 +494,43 @@ usbd_func_selconf(ip) conf = selconf->usc_conf; if (conf == NULL) { device_printf(dev, "select configuration is NULL\n"); - return usbd_usb2urb(USBD_NORMAL_COMPLETION); + return usbd_usb2urb(USB_ERR_NORMAL_COMPLETION); } if (conf->bConfigurationValue > NDISUSB_CONFIG_NO) - device_printf(dev, "warning: config_no is larger than default"); + device_printf(dev, + "warning: config_no is larger than default (%#x/%#x)\n", + conf->bConfigurationValue, NDISUSB_CONFIG_NO); intf = &selconf->usc_intf; for (i = 0; i < conf->bNumInterface && intf->uii_len > 0; i++) { - ret = usbd_device2interface_handle(uaa->device, - intf->uii_intfnum, &iface); - if (ret != USBD_NORMAL_COMPLETION) { - device_printf(dev, - "getting interface handle failed: %s\n", - usbd_errstr(ret)); - return usbd_usb2urb(ret); - } - - ret = usbd_set_interface(iface, intf->uii_altset); - if (ret != USBD_NORMAL_COMPLETION && ret != USBD_IN_USE) { + ret = usb2_set_alt_interface_index(udev, + intf->uii_intfnum, intf->uii_altset); + if (ret != USB_ERR_NORMAL_COMPLETION && ret != USB_ERR_IN_USE) { device_printf(dev, "setting alternate interface failed: %s\n", - usbd_errstr(ret)); + usb2_errstr(ret)); return usbd_usb2urb(ret); } - - for (j = 0; j < iface->idesc->bNumEndpoints; j++) { + + for (j = 0; (p = usb2_pipe_foreach(udev, p)); j++) { if (j >= intf->uii_numeps) { device_printf(dev, "endpoint %d and above are ignored", intf->uii_numeps); break; } - edesc = iface->endpoints[j].edesc; + edesc = p->edesc; pipe = &intf->uii_pipes[j]; pipe->upi_handle = edesc; pipe->upi_epaddr = edesc->bEndpointAddress; pipe->upi_maxpktsize = UGETW(edesc->wMaxPacketSize); pipe->upi_type = UE_GET_XFERTYPE(edesc->bmAttributes); + + ret = usbd_setup_endpoint(ip, intf->uii_intfnum, edesc); + if (ret != USB_ERR_NORMAL_COMPLETION) + return usbd_usb2urb(ret); + if (pipe->upi_type != UE_INTERRUPT) continue; @@ -593,17 +556,98 @@ usbd_func_selconf(ip) return USBD_STATUS_SUCCESS; } +static usb2_error_t +usbd_setup_endpoint(ip, ifidx, ep) + irp *ip; + uint8_t ifidx; + struct usb2_endpoint_descriptor *ep; +{ + device_t dev = IRP_NDIS_DEV(ip); + struct ndis_softc *sc = device_get_softc(dev); + struct ndisusb_ep *ne; + struct usb2_config cfg; + struct usb2_xfer *xfer; + usb2_error_t status; + + /* check for non-supported transfer types */ + if (UE_GET_XFERTYPE(ep->bmAttributes) == UE_CONTROL || + UE_GET_XFERTYPE(ep->bmAttributes) == UE_ISOCHRONOUS) { + device_printf(dev, "%s: unsuppotted transfer types %#x\n", + __func__, UE_GET_XFERTYPE(ep->bmAttributes)); + return (USB_ERR_INVAL); + } + + ne = &sc->ndisusb_ep[NDISUSB_GET_ENDPT(ep->bEndpointAddress)]; + InitializeListHead(&ne->ne_active); + InitializeListHead(&ne->ne_pending); + KeInitializeSpinLock(&ne->ne_lock); + ne->ne_dirin = UE_GET_DIR(ep->bEndpointAddress) >> 7; + + memset(&cfg, 0, sizeof(struct usb2_config)); + cfg.type = UE_GET_XFERTYPE(ep->bmAttributes); + cfg.endpoint = UE_GET_ADDR(ep->bEndpointAddress); + cfg.direction = UE_GET_DIR(ep->bEndpointAddress); + cfg.mh.callback = &usbd_non_isoc_callback; + cfg.mh.bufsize = UGETW(ep->wMaxPacketSize); + cfg.mh.flags.proxy_buffer = 1; + if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_IN) + cfg.mh.flags.short_xfer_ok = 1; + + status = usb2_transfer_setup(sc->ndisusb_dev, &ifidx, ne->ne_xfer, + &cfg, 1, sc, hal_getdisplock()); + if (status != USB_ERR_NORMAL_COMPLETION) { + device_printf(dev, "couldn't setup xfer: %s\n", + usb2_errstr(status)); + return (status); + } + xfer = ne->ne_xfer[0]; + xfer->priv_fifo = ne; + if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_IN) + xfer->timeout = NDISUSB_NO_TIMEOUT; + else { + if (UE_GET_XFERTYPE(ep->bmAttributes) == UE_BULK) + xfer->timeout = NDISUSB_TX_TIMEOUT; + else + xfer->timeout = NDISUSB_INTR_TIMEOUT; + } + + return (status); +} + +static int32_t +usbd_func_abort_pipe(ip) + irp *ip; +{ + struct ndisusb_ep *ne; + uint8_t irql; + union usbd_urb *urb; + + urb = usbd_geturb(ip); + ne = usbd_get_ndisep(ip, urb->uu_pipe.upr_handle); + if (ne == NULL) { + device_printf(IRP_NDIS_DEV(ip), "get NULL endpoint info.\n"); + return (USBD_STATUS_INVALID_PIPE_HANDLE); + } + + KeRaiseIrql(DISPATCH_LEVEL, &irql); + usb2_transfer_stop(ne->ne_xfer[0]); + usb2_transfer_start(ne->ne_xfer[0]); + KeLowerIrql(irql); + + return (USBD_STATUS_SUCCESS); +} + static int32_t usbd_func_vendorclass(ip) irp *ip; { device_t dev = IRP_NDIS_DEV(ip); - struct usb_attach_arg *uaa = device_get_ivars(dev); + struct ndis_softc *sc = device_get_softc(dev); struct usbd_urb_vendor_or_class_request *vcreq; - uint8_t type = 0; + uint8_t irql, type = 0; union usbd_urb *urb; - usb_device_request_t req; - usbd_status status; + struct usb2_device_request req; + usb2_error_t status; urb = usbd_geturb(ip); vcreq = &urb->uu_vcreq; @@ -634,7 +678,7 @@ usbd_func_vendorclass(ip) type = UT_VENDOR | UT_ENDPOINT; break; default: - /* never reach. */ + /* never reached. */ break; } @@ -648,224 +692,201 @@ usbd_func_vendorclass(ip) USETW(req.wValue, vcreq->uvc_value); USETW(req.wLength, vcreq->uvc_trans_buflen); - if (vcreq->uvc_trans_flags & USBD_TRANSFER_DIRECTION_IN) { - mtx_lock(&Giant); - status = usbd_do_request(uaa->device, &req, - vcreq->uvc_trans_buf); - mtx_unlock(&Giant); - } else - status = usbd_do_request_async(uaa->device, &req, - vcreq->uvc_trans_buf); + KeRaiseIrql(DISPATCH_LEVEL, &irql); + status = usb2_do_request(sc->ndisusb_dev, hal_getdisplock(), &req, + vcreq->uvc_trans_buf); + KeLowerIrql(irql); return usbd_usb2urb(status); } -static usbd_status -usbd_init_ndispipe(ip, ep) - irp *ip; - usb_endpoint_descriptor_t *ep; -{ - device_t dev = IRP_NDIS_DEV(ip); - struct ndis_softc *sc = device_get_softc(dev); - struct usb_attach_arg *uaa = device_get_ivars(dev); - usbd_interface_handle iface; - usbd_status status; - - status = usbd_device2interface_handle(uaa->device, NDISUSB_IFACE_INDEX, - &iface); - if (status != USBD_NORMAL_COMPLETION) { - device_printf(dev, "could not get interface handle\n"); - return (status); - } - - switch (UE_GET_XFERTYPE(ep->bmAttributes)) { - case UE_BULK: - if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_IN) { - /* RX (bulk IN) */ - if (sc->ndisusb_ep[NDISUSB_ENDPT_BIN] != NULL) - return (USBD_NORMAL_COMPLETION); - - status = usbd_open_pipe(iface, ep->bEndpointAddress, - USBD_EXCLUSIVE_USE, - &sc->ndisusb_ep[NDISUSB_ENDPT_BIN]); - break; - } - - /* TX (bulk OUT) */ - if (sc->ndisusb_ep[NDISUSB_ENDPT_BOUT] != NULL) - return (USBD_NORMAL_COMPLETION); - - status = usbd_open_pipe(iface, ep->bEndpointAddress, - USBD_EXCLUSIVE_USE, &sc->ndisusb_ep[NDISUSB_ENDPT_BOUT]); - break; - case UE_INTERRUPT: - if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_IN) { - /* Interrupt IN. */ - if (sc->ndisusb_ep[NDISUSB_ENDPT_IIN] != NULL) - return (USBD_NORMAL_COMPLETION); - - status = usbd_open_pipe(iface, ep->bEndpointAddress, - USBD_EXCLUSIVE_USE, - &sc->ndisusb_ep[NDISUSB_ENDPT_IIN]); - break; - } - - /* Interrupt OUT. */ - if (sc->ndisusb_ep[NDISUSB_ENDPT_IOUT] != NULL) - return (USBD_NORMAL_COMPLETION); - - status = usbd_open_pipe(iface, ep->bEndpointAddress, - USBD_EXCLUSIVE_USE, &sc->ndisusb_ep[NDISUSB_ENDPT_IOUT]); - break; - default: - device_printf(dev, "can't handle xfertype 0x%x\n", - UE_GET_XFERTYPE(ep->bmAttributes)); - return (USBD_INVAL); - } - - if (status != USBD_NORMAL_COMPLETION) - device_printf(dev, "open pipe failed: (0x%x) %s\n", - ep->bEndpointAddress, usbd_errstr(status)); - - return (status); -} - -static void -usbd_irpcancel_cb(priv) - void *priv; -{ - struct ndisusb_cancel *nc = priv; - struct ndis_softc *sc = device_get_softc(nc->dev); - usbd_status status; - usbd_xfer_handle xfer = nc->xfer; - - if (sc->ndisusb_status & NDISUSB_STATUS_DETACH) - goto exit; - - status = usbd_abort_pipe(xfer->pipe); - if (status != USBD_NORMAL_COMPLETION) - device_printf(nc->dev, "can't be canceld"); -exit: - free(nc, M_USBDEV); -} - static void usbd_irpcancel(dobj, ip) device_object *dobj; irp *ip; { - device_t dev = IRP_NDIS_DEV(ip); - struct ndisusb_cancel *nc; - struct usb_attach_arg *uaa = device_get_ivars(dev); + struct ndisusb_ep *ne = IRP_NDISUSB_EP(ip); + uint8_t irql; - if (IRP_NDISUSB_XFER(ip) == NULL) { + if (ne == NULL) { ip->irp_cancel = TRUE; IoReleaseCancelSpinLock(ip->irp_cancelirql); return; } /* - * XXX Since we're under DISPATCH_LEVEL during calling usbd_irpcancel(), - * we can't sleep at all. However, currently FreeBSD's USB stack - * requires a sleep to abort a transfer. It's inevitable! so it causes - * serveral fatal problems (e.g. kernel hangups or crashes). I think - * that there are no ways to make this reliable. In this implementation, - * I used usb_add_task() but it's not a perfect method to solve this - * because of as follows: NDIS drivers would expect that IRP's - * completely canceld when usbd_irpcancel() is returned but we need - * a sleep to do it. During canceling XFERs, usbd_intr() would be - * called with a status, USBD_CANCELLED. + * Make sure that the current USB transfer proxy is + * cancelled and then restarted. */ - nc = malloc(sizeof(struct ndisusb_cancel), M_USBDEV, M_NOWAIT | M_ZERO); - if (nc == NULL) { - ip->irp_cancel = FALSE; - IoReleaseCancelSpinLock(ip->irp_cancelirql); - return; - } - - nc->dev = dev; - nc->xfer = IRP_NDISUSB_XFER(ip); - usb_init_task(&nc->task, usbd_irpcancel_cb, nc); - - IRP_NDISUSB_XFER(ip) = NULL; - usb_add_task(uaa->device, &nc->task, USB_TASKQ_DRIVER); + KeRaiseIrql(DISPATCH_LEVEL, &irql); + usb2_transfer_stop(ne->ne_xfer[0]); + usb2_transfer_start(ne->ne_xfer[0]); + KeLowerIrql(irql); ip->irp_cancel = TRUE; IoReleaseCancelSpinLock(ip->irp_cancelirql); } -static usbd_xfer_handle -usbd_init_ndisxfer(ip, ep, buf, buflen) - irp *ip; - usb_endpoint_descriptor_t *ep; - void *buf; - uint32_t buflen; -{ - device_t dev = IRP_NDIS_DEV(ip); - struct usb_attach_arg *uaa = device_get_ivars(dev); - usbd_xfer_handle xfer; - - xfer = usbd_alloc_xfer(uaa->device); - if (xfer == NULL) - return (NULL); - - if (buf != NULL && MmIsAddressValid(buf) == FALSE && buflen > 0) { - xfer->buffer = usbd_alloc_buffer(xfer, buflen); - if (xfer->buffer == NULL) - return (NULL); - - if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_OUT) - memcpy(xfer->buffer, buf, buflen); - } else - xfer->buffer = buf; - - xfer->length = buflen; - - IoAcquireCancelSpinLock(&ip->irp_cancelirql); - IRP_NDISUSB_XFER(ip) = xfer; - ip->irp_cancelfunc = (cancel_func)usbd_irpcancel_wrap; - IoReleaseCancelSpinLock(ip->irp_cancelirql); - - return (xfer); -} - static void -usbd_xferadd(xfer, priv, status) - usbd_xfer_handle xfer; - usbd_private_handle priv; - usbd_status status; +usbd_xfer_complete(struct ndis_softc *sc, struct ndisusb_ep *ne, + struct ndisusb_xfer *nx, usb2_error_t status) { - irp *ip = priv; - device_t dev = IRP_NDIS_DEV(ip); - struct ndis_softc *sc = device_get_softc(dev); - struct ndisusb_xfer *nx; + struct ndisusb_xferdone *nd; uint8_t irql; - nx = malloc(sizeof(struct ndisusb_xfer), M_USBDEV, M_NOWAIT | M_ZERO); - if (nx == NULL) { - device_printf(dev, "out of memory"); + nd = malloc(sizeof(struct ndisusb_xferdone), M_USBDEV, + M_NOWAIT | M_ZERO); + if (nd == NULL) { + device_printf(sc->ndis_dev, "out of memory"); return; } - nx->nx_xfer = xfer; - nx->nx_priv = priv; - nx->nx_status = status; + nd->nd_xfer = nx; + nd->nd_status = status; - KeAcquireSpinLock(&sc->ndisusb_xferlock, &irql); - InsertTailList((&sc->ndisusb_xferlist), (&nx->nx_xferlist)); - KeReleaseSpinLock(&sc->ndisusb_xferlock, irql); + KeAcquireSpinLock(&sc->ndisusb_xferdonelock, &irql); + InsertTailList((&sc->ndisusb_xferdonelist), (&nd->nd_donelist)); + KeReleaseSpinLock(&sc->ndisusb_xferdonelock, irql); - IoQueueWorkItem(sc->ndisusb_xferitem, + IoQueueWorkItem(sc->ndisusb_xferdoneitem, (io_workitem_func)usbd_xfertask_wrap, WORKQUEUE_CRITICAL, sc); } -static void -usbd_xfereof(xfer, priv, status) - usbd_xfer_handle xfer; - usbd_private_handle priv; - usbd_status status; +static struct ndisusb_xfer * +usbd_aq_getfirst(struct ndis_softc *sc, struct ndisusb_ep *ne) { + struct ndisusb_xfer *nx; + uint8_t irql; - usbd_xferadd(xfer, priv, status); + KeAcquireSpinLock(&ne->ne_lock, &irql); + if (IsListEmpty(&ne->ne_active)) { + device_printf(sc->ndis_dev, + "%s: the active queue can't be empty.\n", __func__); + KeReleaseSpinLock(&ne->ne_lock, irql); + return (NULL); + } + nx = CONTAINING_RECORD(ne->ne_active.nle_flink, struct ndisusb_xfer, + nx_next); + RemoveEntryList(&nx->nx_next); + KeReleaseSpinLock(&ne->ne_lock, irql); + + return (nx); +} + +static void +usbd_non_isoc_callback(struct usb2_xfer *xfer) +{ + irp *ip; + struct ndis_softc *sc = xfer->priv_sc; + struct ndisusb_ep *ne = xfer->priv_fifo; + struct ndisusb_xfer *nx; + struct usbd_urb_bulk_or_intr_transfer *ubi; + uint8_t irql; + uint32_t len; + union usbd_urb *urb; + usb_endpoint_descriptor_t *ep; + + switch (USB_GET_STATE(xfer)) { + case USB_ST_TRANSFERRED: + nx = usbd_aq_getfirst(sc, ne); + if (nx == NULL) + return; + + /* copy in data with regard to the URB */ + if (ne->ne_dirin != 0) + usb2_copy_out(xfer->frbuffers, 0, nx->nx_urbbuf, + xfer->frlengths[0]); + nx->nx_urbbuf += xfer->frlengths[0]; + nx->nx_urbactlen += xfer->frlengths[0]; + nx->nx_urblen -= xfer->frlengths[0]; + + /* check for short transfer */ + if (xfer->actlen < xfer->sumlen) + nx->nx_urblen = 0; + else { + /* check remainder */ + if (nx->nx_urblen > 0) { + KeAcquireSpinLock(&ne->ne_lock, &irql); + InsertHeadList((&ne->ne_active), (&nx->nx_next)); + KeReleaseSpinLock(&ne->ne_lock, irql); + + ip = nx->nx_priv; + urb = usbd_geturb(ip); + ubi = &urb->uu_bulkintr; + ep = ubi->ubi_epdesc; + goto extra; + } + } + usbd_xfer_complete(sc, ne, nx, + ((xfer->actlen < xfer->sumlen) && (nx->nx_shortxfer == 0)) ? + USB_ERR_SHORT_XFER : USB_ERR_NORMAL_COMPLETION); + + /* fall through */ + case USB_ST_SETUP: +next: + /* get next transfer */ + KeAcquireSpinLock(&ne->ne_lock, &irql); + if (IsListEmpty(&ne->ne_pending)) { + KeReleaseSpinLock(&ne->ne_lock, irql); + return; + } + nx = CONTAINING_RECORD(ne->ne_pending.nle_flink, + struct ndisusb_xfer, nx_next); + RemoveEntryList(&nx->nx_next); + /* add a entry to the active queue's tail. */ + InsertTailList((&ne->ne_active), (&nx->nx_next)); + KeReleaseSpinLock(&ne->ne_lock, irql); + + ip = nx->nx_priv; + urb = usbd_geturb(ip); + ubi = &urb->uu_bulkintr; + ep = ubi->ubi_epdesc; + + nx->nx_urbbuf = ubi->ubi_trans_buf; + nx->nx_urbactlen = 0; + nx->nx_urblen = ubi->ubi_trans_buflen; + nx->nx_shortxfer = (ubi->ubi_trans_flags & + USBD_SHORT_TRANSFER_OK) ? 1 : 0; +extra: + len = MIN(xfer->max_data_length, nx->nx_urblen); + if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_OUT) + usb2_copy_in(xfer->frbuffers, 0, nx->nx_urbbuf, len); + xfer->frlengths[0] = len; + xfer->nframes = 1; + usb2_start_hardware(xfer); + break; + default: + nx = usbd_aq_getfirst(sc, ne); + if (nx == NULL) + return; + if (xfer->error != USB_ERR_CANCELLED) { + xfer->flags.stall_pipe = 1; + device_printf(sc->ndis_dev, "usb xfer warning (%s)\n", + usb2_errstr(xfer->error)); + } + usbd_xfer_complete(sc, ne, nx, xfer->error); + if (xfer->error != USB_ERR_CANCELLED) + goto next; + break; + } +} + +static struct ndisusb_ep * +usbd_get_ndisep(ip, ep) + irp *ip; + usb_endpoint_descriptor_t *ep; +{ + device_t dev = IRP_NDIS_DEV(ip); + struct ndis_softc *sc = device_get_softc(dev); + struct ndisusb_ep *ne; + + ne = &sc->ndisusb_ep[NDISUSB_GET_ENDPT(ep->bEndpointAddress)]; + + IoAcquireCancelSpinLock(&ip->irp_cancelirql); + IRP_NDISUSB_EP(ip) = ne; + ip->irp_cancelfunc = (cancel_func)usbd_irpcancel_wrap; + IoReleaseCancelSpinLock(ip->irp_cancelirql); + + return (ne); } static void @@ -878,72 +899,49 @@ usbd_xfertask(dobj, arg) device_t dev; list_entry *l; struct ndis_softc *sc = arg; - struct ndisusb_xfer *nx; + struct ndisusb_xferdone *nd; + struct ndisusb_xfer *nq; struct usbd_urb_bulk_or_intr_transfer *ubi; uint8_t irql; union usbd_urb *urb; - usbd_private_handle priv; - usbd_status status; - usbd_xfer_handle xfer; + usb2_error_t status; + void *priv; dev = sc->ndis_dev; - if (IsListEmpty(&sc->ndisusb_xferlist)) + if (IsListEmpty(&sc->ndisusb_xferdonelist)) return; - KeAcquireSpinLock(&sc->ndisusb_xferlock, &irql); - l = sc->ndisusb_xferlist.nle_flink; - while (l != &sc->ndisusb_xferlist) { - nx = CONTAINING_RECORD(l, struct ndisusb_xfer, nx_xferlist); - xfer = nx->nx_xfer; - priv = nx->nx_priv; - status = nx->nx_status; + KeAcquireSpinLock(&sc->ndisusb_xferdonelock, &irql); + l = sc->ndisusb_xferdonelist.nle_flink; + while (l != &sc->ndisusb_xferdonelist) { + nd = CONTAINING_RECORD(l, struct ndisusb_xferdone, nd_donelist); + nq = nd->nd_xfer; + priv = nq->nx_priv; + status = nd->nd_status; error = 0; ip = priv; - - if (status != USBD_NORMAL_COMPLETION) { - if (status == USBD_NOT_STARTED) { - error = 1; - goto next; - } - if (status == USBD_STALLED) - usbd_clear_endpoint_stall_async(xfer->pipe); - /* - * NB: just for notice. We must handle error cases also - * because if we just return without notifying to the - * NDIS driver the driver never knows about that there - * was a error. This can cause a lot of problems like - * system hangs. - */ - device_printf(dev, "usb xfer warning (%s)\n", - usbd_errstr(status)); - } - urb = usbd_geturb(ip); - + KASSERT(urb->uu_hdr.uuh_func == URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER, ("function(%d) isn't for bulk or interrupt", urb->uu_hdr.uuh_func)); - + IoAcquireCancelSpinLock(&ip->irp_cancelirql); - + ip->irp_cancelfunc = NULL; - IRP_NDISUSB_XFER(ip) = NULL; - + IRP_NDISUSB_EP(ip) = NULL; + switch (status) { - case USBD_NORMAL_COMPLETION: + case USB_ERR_NORMAL_COMPLETION: ubi = &urb->uu_bulkintr; - ubi->ubi_trans_buflen = xfer->actlen; - if (ubi->ubi_trans_flags & USBD_TRANSFER_DIRECTION_IN) - memcpy(ubi->ubi_trans_buf, xfer->buffer, - xfer->actlen); - - ip->irp_iostat.isb_info = xfer->actlen; + ubi->ubi_trans_buflen = nq->nx_urbactlen; + ip->irp_iostat.isb_info = nq->nx_urbactlen; ip->irp_iostat.isb_status = STATUS_SUCCESS; USBD_URB_STATUS(urb) = USBD_STATUS_SUCCESS; break; - case USBD_CANCELLED: + case USB_ERR_CANCELLED: ip->irp_iostat.isb_info = 0; ip->irp_iostat.isb_status = STATUS_CANCELLED; USBD_URB_STATUS(urb) = USBD_STATUS_CANCELED; @@ -955,32 +953,31 @@ usbd_xfertask(dobj, arg) usbd_urb2nt(USBD_URB_STATUS(urb)); break; } - + IoReleaseCancelSpinLock(ip->irp_cancelirql); -next: + l = l->nle_flink; - RemoveEntryList(&nx->nx_xferlist); - usbd_free_xfer(nx->nx_xfer); - free(nx, M_USBDEV); + RemoveEntryList(&nd->nd_donelist); + free(nq, M_USBDEV); + free(nd, M_USBDEV); if (error) continue; /* NB: call after cleaning */ IoCompleteRequest(ip, IO_NO_INCREMENT); } - KeReleaseSpinLock(&sc->ndisusb_xferlock, irql); + KeReleaseSpinLock(&sc->ndisusb_xferdonelock, irql); } static int32_t usbd_func_bulkintr(ip) irp *ip; { - device_t dev = IRP_NDIS_DEV(ip); - struct ndis_softc *sc = device_get_softc(dev); + struct ndisusb_ep *ne; + struct ndisusb_xfer *nx; struct usbd_urb_bulk_or_intr_transfer *ubi; + uint8_t irql; union usbd_urb *urb; usb_endpoint_descriptor_t *ep; - usbd_status status; - usbd_xfer_handle xfer; urb = usbd_geturb(ip); ubi = &urb->uu_bulkintr; @@ -988,49 +985,22 @@ usbd_func_bulkintr(ip) if (ep == NULL) return (USBD_STATUS_INVALID_PIPE_HANDLE); - status = usbd_init_ndispipe(ip, ep); - if (status != USBD_NORMAL_COMPLETION) - return usbd_usb2urb(status); + ne = usbd_get_ndisep(ip, ep); + if (ne == NULL) { + device_printf(IRP_NDIS_DEV(ip), "get NULL endpoint info.\n"); + return (USBD_STATUS_INVALID_PIPE_HANDLE); + } - xfer = usbd_init_ndisxfer(ip, ep, ubi->ubi_trans_buf, - ubi->ubi_trans_buflen); - if (xfer == NULL) { - device_printf(IRP_NDIS_DEV(ip), "can't allocate xfer\n"); + nx = malloc(sizeof(struct ndisusb_xfer), M_USBDEV, M_NOWAIT | M_ZERO); + if (nx == NULL) { + device_printf(IRP_NDIS_DEV(ip), "out of memory\n"); return (USBD_STATUS_NO_MEMORY); } - - if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_IN) { - xfer->flags |= USBD_SHORT_XFER_OK; - if (!(ubi->ubi_trans_flags & USBD_SHORT_TRANSFER_OK)) - xfer->flags &= ~USBD_SHORT_XFER_OK; - } - - if (UE_GET_XFERTYPE(ep->bmAttributes) == UE_BULK) { - if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_IN) - /* RX (bulk IN) */ - usbd_setup_xfer(xfer, sc->ndisusb_ep[NDISUSB_ENDPT_BIN], - ip, xfer->buffer, xfer->length, xfer->flags, - USBD_NO_TIMEOUT, usbd_xfereof); - else { - /* TX (bulk OUT) */ - xfer->flags |= USBD_NO_COPY; - - usbd_setup_xfer(xfer, sc->ndisusb_ep[NDISUSB_ENDPT_BOUT], - ip, xfer->buffer, xfer->length, xfer->flags, - NDISUSB_TX_TIMEOUT, usbd_xfereof); - } - } else { - if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_IN) - /* Interrupt IN */ - usbd_setup_xfer(xfer, sc->ndisusb_ep[NDISUSB_ENDPT_IIN], - ip, xfer->buffer, xfer->length, xfer->flags, - USBD_NO_TIMEOUT, usbd_xfereof); - else - /* Interrupt OUT */ - usbd_setup_xfer(xfer, sc->ndisusb_ep[NDISUSB_ENDPT_IOUT], - ip, xfer->buffer, xfer->length, xfer->flags, - NDISUSB_INTR_TIMEOUT, usbd_xfereof); - } + nx->nx_ep = ne; + nx->nx_priv = ip; + KeAcquireSpinLock(&ne->ne_lock, &irql); + InsertTailList((&ne->ne_pending), (&nx->nx_next)); + KeReleaseSpinLock(&ne->ne_lock, irql); /* we've done to setup xfer. Let's transfer it. */ ip->irp_iostat.isb_status = STATUS_PENDING; @@ -1038,35 +1008,30 @@ usbd_func_bulkintr(ip) USBD_URB_STATUS(urb) = USBD_STATUS_PENDING; IoMarkIrpPending(ip); - status = usbd_transfer(xfer); - if (status == USBD_IN_PROGRESS) - return (USBD_STATUS_PENDING); + KeRaiseIrql(DISPATCH_LEVEL, &irql); + usb2_transfer_start(ne->ne_xfer[0]); + KeLowerIrql(irql); - usbd_free_xfer(xfer); - IRP_NDISUSB_XFER(ip) = NULL; - IoUnmarkIrpPending(ip); - USBD_URB_STATUS(urb) = usbd_usb2urb(status); - - return USBD_URB_STATUS(urb); + return (USBD_STATUS_PENDING); } static union usbd_urb * USBD_CreateConfigurationRequest(conf, len) - usb_config_descriptor_t *conf; + usb_config_descriptor_t *conf; uint16_t *len; { - struct usbd_interface_list_entry list[2]; - union usbd_urb *urb; + struct usbd_interface_list_entry list[2]; + union usbd_urb *urb; bzero(list, sizeof(struct usbd_interface_list_entry) * 2); - list[0].uil_intfdesc = USBD_ParseConfigurationDescriptorEx(conf, conf, + list[0].uil_intfdesc = USBD_ParseConfigurationDescriptorEx(conf, conf, -1, -1, -1, -1, -1); - urb = USBD_CreateConfigurationRequestEx(conf, list); - if (urb == NULL) - return NULL; + urb = USBD_CreateConfigurationRequestEx(conf, list); + if (urb == NULL) + return NULL; - *len = urb->uu_selconf.usc_hdr.uuh_len; - return urb; + *len = urb->uu_selconf.usc_hdr.uuh_len; + return urb; } static union usbd_urb * @@ -1074,11 +1039,11 @@ USBD_CreateConfigurationRequestEx(conf, list) usb_config_descriptor_t *conf; struct usbd_interface_list_entry *list; { - int i, j, size; - struct usbd_interface_information *intf; - struct usbd_pipe_information *pipe; - struct usbd_urb_select_configuration *selconf; - usb_interface_descriptor_t *desc; + int i, j, size; + struct usbd_interface_information *intf; + struct usbd_pipe_information *pipe; + struct usbd_urb_select_configuration *selconf; + usb_interface_descriptor_t *desc; for (i = 0, size = 0; i < conf->bNumInterface; i++) { j = list[i].uil_intfdesc->bNumEndpoints; @@ -1088,49 +1053,50 @@ USBD_CreateConfigurationRequestEx(conf, list) size += sizeof(struct usbd_urb_select_configuration) - sizeof(struct usbd_interface_information); - selconf = ExAllocatePoolWithTag(NonPagedPool, size, 0); - if (selconf == NULL) - return NULL; - selconf->usc_hdr.uuh_func = URB_FUNCTION_SELECT_CONFIGURATION; - selconf->usc_hdr.uuh_len = size; - selconf->usc_handle = conf; - selconf->usc_conf = conf; + selconf = ExAllocatePoolWithTag(NonPagedPool, size, 0); + if (selconf == NULL) + return NULL; + selconf->usc_hdr.uuh_func = URB_FUNCTION_SELECT_CONFIGURATION; + selconf->usc_hdr.uuh_len = size; + selconf->usc_handle = conf; + selconf->usc_conf = conf; - intf = &selconf->usc_intf; - for (i = 0; i < conf->bNumInterface; i++) { + intf = &selconf->usc_intf; + for (i = 0; i < conf->bNumInterface; i++) { if (list[i].uil_intfdesc == NULL) break; - list[i].uil_intf = intf; - desc = list[i].uil_intfdesc; + list[i].uil_intf = intf; + desc = list[i].uil_intfdesc; - intf->uii_len = sizeof(struct usbd_interface_information) + + intf->uii_len = sizeof(struct usbd_interface_information) + (desc->bNumEndpoints - 1) * sizeof(struct usbd_pipe_information); - intf->uii_intfnum = desc->bInterfaceNumber; - intf->uii_altset = desc->bAlternateSetting; - intf->uii_intfclass = desc->bInterfaceClass; - intf->uii_intfsubclass = desc->bInterfaceSubClass; - intf->uii_intfproto = desc->bInterfaceProtocol; - intf->uii_handle = desc; - intf->uii_numeps = desc->bNumEndpoints; + intf->uii_intfnum = desc->bInterfaceNumber; + intf->uii_altset = desc->bAlternateSetting; + intf->uii_intfclass = desc->bInterfaceClass; + intf->uii_intfsubclass = desc->bInterfaceSubClass; + intf->uii_intfproto = desc->bInterfaceProtocol; + intf->uii_handle = desc; + intf->uii_numeps = desc->bNumEndpoints; - pipe = &intf->uii_pipes[0]; - for (j = 0; j < intf->uii_numeps; j++) - pipe[j].upi_maxtxsize = + pipe = &intf->uii_pipes[0]; + for (j = 0; j < intf->uii_numeps; j++) + pipe[j].upi_maxtxsize = USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE; - intf = (struct usbd_interface_information *)((char *)intf + + intf = (struct usbd_interface_information *)((char *)intf + intf->uii_len); - } + } - return ((union usbd_urb *)selconf); + return ((union usbd_urb *)selconf); } static void USBD_GetUSBDIVersion(ui) usbd_version_info *ui; { + /* Pretend to be Windows XP. */ ui->uvi_usbdi_vers = USBDI_VERSION; @@ -1143,7 +1109,8 @@ static usb_interface_descriptor_t * USBD_ParseConfigurationDescriptor(usb_config_descriptor_t *conf, uint8_t intfnum, uint8_t altset) { - return USBD_ParseConfigurationDescriptorEx(conf, conf, intfnum, altset, + + return USBD_ParseConfigurationDescriptorEx(conf, conf, intfnum, altset, -1, -1, -1); } @@ -1216,4 +1183,3 @@ image_patch_table usbd_functbl[] = { }; MODULE_DEPEND(ndis, usb, 1, 1, 1); - diff --git a/sys/compat/ndis/usbd_var.h b/sys/compat/ndis/usbd_var.h index 59009a7c8acc..019bd32a9715 100644 --- a/sys/compat/ndis/usbd_var.h +++ b/sys/compat/ndis/usbd_var.h @@ -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 diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index d20308f0fc5d..d6fc925cb80b 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -74,8 +74,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include #include #include @@ -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; } diff --git a/sys/dev/if_ndis/if_ndis_pccard.c b/sys/dev/if_ndis/if_ndis_pccard.c index d84550a81531..70c57a393974 100644 --- a/sys/dev/if_ndis/if_ndis_pccard.c +++ b/sys/dev/if_ndis/if_ndis_pccard.c @@ -51,10 +51,10 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include +#include -#include -#include +#include #include #include diff --git a/sys/dev/if_ndis/if_ndis_pci.c b/sys/dev/if_ndis/if_ndis_pci.c index afadd8ab27c4..371471867ada 100644 --- a/sys/dev/if_ndis/if_ndis_pci.c +++ b/sys/dev/if_ndis/if_ndis_pci.c @@ -54,8 +54,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include #include #include diff --git a/sys/dev/if_ndis/if_ndis_usb.c b/sys/dev/if_ndis/if_ndis_usb.c index 1de308db48e2..79f104f2723e 100644 --- a/sys/dev/if_ndis/if_ndis_usb.c +++ b/sys/dev/if_ndis/if_ndis_usb.c @@ -52,11 +52,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include -#include "usbdevs.h" +#include +#include #include @@ -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); } diff --git a/sys/dev/if_ndis/if_ndisvar.h b/sys/dev/if_ndis/if_ndisvar.h index 6b6a450bd544..c661491c4b4d 100644 --- a/sys/dev/if_ndis/if_ndisvar.h +++ b/sys/dev/if_ndis/if_ndisvar.h @@ -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) diff --git a/sys/modules/if_ndis/Makefile b/sys/modules/if_ndis/Makefile index 0830aec1c694..79a9b884962b 100644 --- a/sys/modules/if_ndis/Makefile +++ b/sys/modules/if_ndis/Makefile @@ -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 diff --git a/sys/modules/ndis/Makefile b/sys/modules/ndis/Makefile index 647b787cea7f..8ef7089ac3f3 100644 --- a/sys/modules/ndis/Makefile +++ b/sys/modules/ndis/Makefile @@ -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