diff --git a/reactos/drivers/usb/usbport/debug.c b/reactos/drivers/usb/usbport/debug.c index 07d2f44533f..ee32ccd3d2d 100644 --- a/reactos/drivers/usb/usbport/debug.c +++ b/reactos/drivers/usb/usbport/debug.c @@ -9,7 +9,7 @@ ULONG NTAPI -USBPORT_DbgPrint(IN PVOID Context, +USBPORT_DbgPrint(IN PVOID MiniPortExtension, IN ULONG Level, IN PCH Format, ...) @@ -20,7 +20,7 @@ USBPORT_DbgPrint(IN PVOID Context, ULONG NTAPI -USBPORT_TestDebugBreak(IN PVOID Context) +USBPORT_TestDebugBreak(IN PVOID MiniPortExtension) { DPRINT("USBPORT_TestDebugBreak: UNIMPLEMENTED. FIXME. \n"); return 0; @@ -28,7 +28,7 @@ USBPORT_TestDebugBreak(IN PVOID Context) ULONG NTAPI -USBPORT_AssertFailure(PVOID Context, +USBPORT_AssertFailure(PVOID MiniPortExtension, PVOID FailedAssertion, PVOID FileName, ULONG LineNumber, @@ -41,7 +41,7 @@ USBPORT_AssertFailure(PVOID Context, VOID NTAPI -USBPORT_BugCheck(IN PVOID Context) +USBPORT_BugCheck(IN PVOID MiniPortExtension) { DPRINT1("USBPORT_BugCheck: FIXME \n"); //KeBugCheckEx(BUGCODE_USB_DRIVER, ...); @@ -50,15 +50,15 @@ USBPORT_BugCheck(IN PVOID Context) ULONG NTAPI -USBPORT_LogEntry(IN PVOID BusContext, +USBPORT_LogEntry(IN PVOID MiniPortExtension, IN ULONG DriverTag, IN ULONG EnumTag, IN ULONG P1, IN ULONG P2, IN ULONG P3) { - DPRINT_MINIPORT("USBPORT_LogEntry: BusContext - %p, EnumTag - %lx, P1 - %lx, P2 - %lx, P3 - %lx\n", - BusContext, + DPRINT_MINIPORT("USBPORT_LogEntry: MiniPortExtension - %p, EnumTag - %lx, P1 - %lx, P2 - %lx, P3 - %lx\n", + MiniPortExtension, EnumTag, P1, P2, diff --git a/reactos/drivers/usb/usbport/pnp.c b/reactos/drivers/usb/usbport/pnp.c index 844e7db3e28..f8bfc854600 100644 --- a/reactos/drivers/usb/usbport/pnp.c +++ b/reactos/drivers/usb/usbport/pnp.c @@ -1372,7 +1372,7 @@ Exit: if (!(FdoCommonExtension->PnpStateFlags & USBPORT_PNP_STATE_FAILED)) { USBPORT_InvalidateControllerHandler(FdoDevice, - INVALIDATE_CONTROLLER_SURPRISE_REMOVE); + USBPORT_INVALIDATE_CONTROLLER_SURPRISE_REMOVE); } goto ForwardIrp; diff --git a/reactos/drivers/usb/usbport/roothub.c b/reactos/drivers/usb/usbport/roothub.c index 4dc9b5d8578..23070267e73 100644 --- a/reactos/drivers/usb/usbport/roothub.c +++ b/reactos/drivers/usb/usbport/roothub.c @@ -907,7 +907,7 @@ USBPORT_RootHubCreateDevice(IN PDEVICE_OBJECT FdoDevice, ULONG NTAPI -USBPORT_InvalidateRootHub(PVOID Context) +USBPORT_InvalidateRootHub(PVOID MiniPortExtension) { PUSBPORT_DEVICE_EXTENSION FdoExtension; PDEVICE_OBJECT FdoDevice; @@ -917,7 +917,7 @@ USBPORT_InvalidateRootHub(PVOID Context) DPRINT("USBPORT_InvalidateRootHub ... \n"); - FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)Context - + FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)MiniPortExtension - sizeof(USBPORT_DEVICE_EXTENSION)); FdoDevice = FdoExtension->CommonExtension.SelfDevice; diff --git a/reactos/drivers/usb/usbport/usbport.c b/reactos/drivers/usb/usbport/usbport.c index 9a099828e2d..8318fe869e7 100644 --- a/reactos/drivers/usb/usbport/usbport.c +++ b/reactos/drivers/usb/usbport/usbport.c @@ -363,7 +363,7 @@ USBPORT_GetRegistryKeyValueFullInfo(IN PDEVICE_OBJECT FdoDevice, MPSTATUS NTAPI -USBPORT_GetMiniportRegistryKeyValue(IN PVOID Context, +USBPORT_GetMiniportRegistryKeyValue(IN PVOID MiniPortExtension, IN BOOL UseDriverKey, IN PCWSTR SourceString, IN SIZE_T LengthStr, @@ -374,18 +374,15 @@ USBPORT_GetMiniportRegistryKeyValue(IN PVOID Context, PDEVICE_OBJECT FdoDevice; NTSTATUS Status; - DPRINT("USBPORT_GetMiniportRegistryKeyValue: Context - %p, UseDriverKey - %x, SourceString - %S, LengthStr - %x, Buffer - %p, BufferLength - %x\n", - Context, + DPRINT("USBPORT_GetMiniportRegistryKeyValue: MiniPortExtension - %p, UseDriverKey - %x, SourceString - %S, LengthStr - %x, Buffer - %p, BufferLength - %x\n", + MiniPortExtension, UseDriverKey, SourceString, LengthStr, Buffer, BufferLength); - //DbgBreakPoint(); - - //FdoExtension->MiniPortExt = (PVOID)((ULONG_PTR)FdoExtension + sizeof(USBPORT_DEVICE_EXTENSION)); - FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)Context - + FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)MiniPortExtension - sizeof(USBPORT_DEVICE_EXTENSION)); FdoDevice = FdoExtension->CommonExtension.SelfDevice; @@ -449,7 +446,7 @@ USBPORT_GetSetConfigSpaceData(IN PDEVICE_OBJECT FdoDevice, MPSTATUS NTAPI -USBPORT_ReadWriteConfigSpace(IN PVOID Context, +USBPORT_ReadWriteConfigSpace(IN PVOID MiniPortExtension, IN BOOLEAN IsReadData, IN PVOID Buffer, IN ULONG Offset, @@ -462,7 +459,7 @@ USBPORT_ReadWriteConfigSpace(IN PVOID Context, DPRINT("USBPORT_ReadWriteConfigSpace: ... \n"); //FdoExtension->MiniPortExt = (PVOID)((ULONG_PTR)FdoExtension + sizeof(USBPORT_DEVICE_EXTENSION)); - FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)Context - + FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)MiniPortExtension - sizeof(USBPORT_DEVICE_EXTENSION)); FdoDevice = FdoExtension->CommonExtension.SelfDevice; @@ -536,7 +533,7 @@ USBPORT_USBDStatusToNtStatus(IN PURB Urb, NTSTATUS NTAPI -USBPORT_Wait(IN PVOID Context, +USBPORT_Wait(IN PVOID MiniPortExtension, IN ULONG Milliseconds) { LARGE_INTEGER Interval = {{0, 0}}; @@ -640,15 +637,15 @@ USBPORT_InvalidateControllerHandler(IN PDEVICE_OBJECT FdoDevice, switch (Type) { - case INVALIDATE_CONTROLLER_RESET: + case USBPORT_INVALIDATE_CONTROLLER_RESET: DPRINT1("USBPORT_InvalidateControllerHandler: INVALIDATE_CONTROLLER_RESET UNIMPLEMENTED. FIXME. \n"); break; - case INVALIDATE_CONTROLLER_SURPRISE_REMOVE: + case USBPORT_INVALIDATE_CONTROLLER_SURPRISE_REMOVE: DPRINT1("USBPORT_InvalidateControllerHandler: INVALIDATE_CONTROLLER_SURPRISE_REMOVE UNIMPLEMENTED. FIXME. \n"); break; - case INVALIDATE_CONTROLLER_SOFT_INTERRUPT: + case USBPORT_INVALIDATE_CONTROLLER_SOFT_INTERRUPT: if (InterlockedIncrement(&FdoExtension->IsrDpcCounter)) { InterlockedDecrement(&FdoExtension->IsrDpcCounter); @@ -663,7 +660,7 @@ USBPORT_InvalidateControllerHandler(IN PDEVICE_OBJECT FdoDevice, ULONG NTAPI -USBPORT_InvalidateController(IN PVOID Context, +USBPORT_InvalidateController(IN PVOID MiniPortExtension, IN ULONG Type) { PUSBPORT_DEVICE_EXTENSION FdoExtension; @@ -672,7 +669,7 @@ USBPORT_InvalidateController(IN PVOID Context, DPRINT("USBPORT_InvalidateController: Invalidate Type - %x\n", Type); //FdoExtension->MiniPortExt = (PVOID)((ULONG_PTR)FdoExtension + sizeof(USBPORT_DEVICE_EXTENSION)); - FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)Context - + FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)MiniPortExtension - sizeof(USBPORT_DEVICE_EXTENSION)); FdoDevice = FdoExtension->CommonExtension.SelfDevice; @@ -683,8 +680,8 @@ USBPORT_InvalidateController(IN PVOID Context, ULONG NTAPI -USBPORT_NotifyDoubleBuffer(IN PVOID Context1, - IN PVOID Context2, +USBPORT_NotifyDoubleBuffer(IN PVOID MiniPortExtension, + IN PVOID MiniPortTransfer, IN PVOID Buffer, IN SIZE_T Length) { @@ -2011,7 +2008,7 @@ USBPORT_AsyncTimerDpc(IN PRKDPC Dpc, ULONG NTAPI -USBPORT_RequestAsyncCallback(IN PVOID Context, +USBPORT_RequestAsyncCallback(IN PVOID MiniPortExtension, IN ULONG TimerValue, IN PVOID Buffer, IN SIZE_T Length, @@ -2024,7 +2021,7 @@ USBPORT_RequestAsyncCallback(IN PVOID Context, DPRINT("USBPORT_RequestAsyncCallback: ... \n"); - FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)Context - + FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)MiniPortExtension - sizeof(USBPORT_DEVICE_EXTENSION)); FdoDevice = FdoExtension->CommonExtension.SelfDevice; @@ -2096,8 +2093,8 @@ USBPORT_GetMappedVirtualAddress(IN PVOID PhysicalAddress, ULONG NTAPI -USBPORT_InvalidateEndpoint(IN PVOID Context1, - IN PVOID Context2) +USBPORT_InvalidateEndpoint(IN PVOID MiniPortExtension, + IN PVOID MiniPortEndpoint) { PUSBPORT_DEVICE_EXTENSION FdoExtension; PDEVICE_OBJECT FdoDevice; @@ -2105,27 +2102,26 @@ USBPORT_InvalidateEndpoint(IN PVOID Context1, DPRINT_CORE("USBPORT_InvalidateEndpoint: ... \n"); - FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)Context1 - + FdoExtension = (PUSBPORT_DEVICE_EXTENSION)((ULONG_PTR)MiniPortExtension - sizeof(USBPORT_DEVICE_EXTENSION)); FdoDevice = FdoExtension->CommonExtension.SelfDevice; - Endpoint = (PUSBPORT_ENDPOINT)((ULONG_PTR)Context2 - - sizeof(USBPORT_ENDPOINT)); - - if (Context2) - { - USBPORT_InvalidateEndpointHandler(FdoDevice, - Endpoint, - INVALIDATE_ENDPOINT_ONLY); - } - else + if (!MiniPortEndpoint) { USBPORT_InvalidateEndpointHandler(FdoDevice, NULL, INVALIDATE_ENDPOINT_ONLY); + return 0; } + Endpoint = (PUSBPORT_ENDPOINT)((ULONG_PTR)MiniPortEndpoint - + sizeof(USBPORT_ENDPOINT)); + + USBPORT_InvalidateEndpointHandler(FdoDevice, + Endpoint, + INVALIDATE_ENDPOINT_ONLY); + return 0; } @@ -2698,7 +2694,7 @@ USBPORT_RegisterUSBPortDriver(IN PDRIVER_OBJECT DriverObject, DPRINT("USBPORT_RegisterUSBPortDriver: sizeof(USBPORT_DEVICE_EXTENSION) - %x\n", sizeof(USBPORT_DEVICE_EXTENSION)); - if (Version < 100) // 100 - USB1.1; 200 - USB2.0 + if (Version < USB10_MINIPORT_INTERFACE_VERSION) { return STATUS_UNSUCCESSFUL; } diff --git a/reactos/drivers/usb/usbport/usbport.h b/reactos/drivers/usb/usbport/usbport.h index 4771c05601c..637a7eac41c 100644 --- a/reactos/drivers/usb/usbport/usbport.h +++ b/reactos/drivers/usb/usbport/usbport.h @@ -26,10 +26,6 @@ #define USBPORT_RECIPIENT_ROOT_HUB BMREQUEST_TO_DEVICE #define USBPORT_RECIPIENT_ROOT_PORT BMREQUEST_TO_OTHER -#define INVALIDATE_CONTROLLER_RESET 1 -#define INVALIDATE_CONTROLLER_SURPRISE_REMOVE 2 -#define INVALIDATE_CONTROLLER_SOFT_INTERRUPT 3 - #define INVALIDATE_ENDPOINT_ONLY 0 #define INVALIDATE_ENDPOINT_WORKER_THREAD 1 #define INVALIDATE_ENDPOINT_WORKER_DPC 2 @@ -414,7 +410,7 @@ USBPORT_USBDStatusToNtStatus( NTSTATUS NTAPI USBPORT_Wait( - IN PVOID Context, + IN PVOID MiniPortExtension, IN ULONG Milliseconds); VOID @@ -570,7 +566,7 @@ USBPORT_InvalidateControllerHandler( ULONG NTAPI USBPORT_DbgPrint( - IN PVOID Context, + IN PVOID MiniPortExtension, IN ULONG Level, IN PCH Format, ...); @@ -578,12 +574,12 @@ USBPORT_DbgPrint( ULONG NTAPI USBPORT_TestDebugBreak( - IN PVOID Context); + IN PVOID MiniPortExtension); ULONG NTAPI USBPORT_AssertFailure( - PVOID Context, + PVOID MiniPortExtension, PVOID FailedAssertion, PVOID FileName, ULONG LineNumber, @@ -592,12 +588,12 @@ USBPORT_AssertFailure( VOID NTAPI USBPORT_BugCheck( - IN PVOID Context); + IN PVOID MiniPortExtension); ULONG NTAPI USBPORT_LogEntry( - IN PVOID BusContext, + IN PVOID MiniPortExtension, IN ULONG DriverTag, IN ULONG EnumTag, IN ULONG P1, @@ -1090,7 +1086,7 @@ USBPORT_RootHubCreateDevice( ULONG NTAPI USBPORT_InvalidateRootHub( - PVOID Context); + PVOID MiniPortExtension); VOID NTAPI diff --git a/reactos/sdk/include/reactos/drivers/usbport/usbmport.h b/reactos/sdk/include/reactos/drivers/usbport/usbmport.h index 09f3c1e26b9..9ab71b3b134 100644 --- a/reactos/sdk/include/reactos/drivers/usbport/usbmport.h +++ b/reactos/sdk/include/reactos/drivers/usbport/usbmport.h @@ -21,6 +21,21 @@ #define USBPORT_ENDPOINT_HALT 1 #define USBPORT_ENDPOINT_CONTROL 4 +/* Interrupt Endpoint Poll Interval */ +#define ENDPOINT_INTERRUPT_1ms 1 +#define ENDPOINT_INTERRUPT_2ms 2 +#define ENDPOINT_INTERRUPT_4ms 4 +#define ENDPOINT_INTERRUPT_8ms 8 +#define ENDPOINT_INTERRUPT_16ms 16 +#define ENDPOINT_INTERRUPT_32ms 32 + +#define INTERRUPT_ENDPOINTs (ENDPOINT_INTERRUPT_32ms + \ + ENDPOINT_INTERRUPT_16ms + \ + ENDPOINT_INTERRUPT_8ms + \ + ENDPOINT_INTERRUPT_4ms + \ + ENDPOINT_INTERRUPT_2ms + \ + ENDPOINT_INTERRUPT_1ms) + /* Types of resources. For USBPORT_RESOURCES::ResourcesTypes */ #define USBPORT_RESOURCES_PORT 1 #define USBPORT_RESOURCES_INTERRUPT 2 @@ -405,6 +420,10 @@ typedef NTSTATUS PVOID, ULONG); +#define USBPORT_INVALIDATE_CONTROLLER_RESET 1 +#define USBPORT_INVALIDATE_CONTROLLER_SURPRISE_REMOVE 2 +#define USBPORT_INVALIDATE_CONTROLLER_SOFT_INTERRUPT 3 + typedef ULONG (NTAPI *PUSBPORT_INVALIDATE_CONTROLLER)( PVOID, @@ -453,6 +472,9 @@ typedef VOID #define USB_MINIPORT_FLAGS_NO_DMA 0x0100 #define USB_MINIPORT_FLAGS_WAKE_SUPPORT 0x0200 +#define TOTAL_USB11_BUS_BANDWIDTH 12000 +#define TOTAL_USB20_BUS_BANDWIDTH 400000 + typedef struct _USBPORT_REGISTRATION_PACKET { ULONG MiniPortVersion; ULONG MiniPortFlags; @@ -545,6 +567,9 @@ typedef struct _USBPORT_REGISTRATION_PACKET { ULONG Reserved5; } USBPORT_REGISTRATION_PACKET, *PUSBPORT_REGISTRATION_PACKET; +#define USB10_MINIPORT_INTERFACE_VERSION 100 +#define USB20_MINIPORT_INTERFACE_VERSION 200 + typedef struct _USBPORT_MINIPORT_INTERFACE { PDRIVER_OBJECT DriverObject; LIST_ENTRY DriverLink;