29 DPRINT(
"Allocating URB\n");
75 DPRINT(
"Allocating URB\n");
171 Context->Irp->IoStatus.Information = 0;
183 Context->FDODeviceExtension->SrbErrorHandlingActive =
FALSE;
188 Context->FDODeviceExtension->LastTimerActiveSrb =
NULL;
202 Context->FDODeviceExtension->SrbErrorHandlingActive =
FALSE;
207 Context->FDODeviceExtension->TimerWorkQueueEnabled =
TRUE;
212 Context->FDODeviceExtension->LastTimerActiveSrb =
NULL;
222 DPRINT1(
"USBSTOR_HandleTransferError returning with Status %x\n",
Status);
298 Status =
USBSTOR_ResetPipeWithHandle(FDODeviceExtension->LowerDeviceObject, FDODeviceExtension->InterfaceInformation->Pipes[FDODeviceExtension->BulkInPipeIndex].PipeHandle);
304 Status =
USBSTOR_ResetPipeWithHandle(FDODeviceExtension->LowerDeviceObject, FDODeviceExtension->InterfaceInformation->Pipes[FDODeviceExtension->BulkOutPipeIndex].PipeHandle);
312 FDODeviceExtension->LastTimerActiveSrb =
NULL;
324 FDODeviceExtension->TimerWorkQueueEnabled =
FALSE;
347 DPRINT1(
"[USBSTOR] TimerRoutine entered\n");
348 DPRINT1(
"[USBSTOR] ActiveSrb %p ResetInProgress %x LastTimerActiveSrb %p\n", FDODeviceExtension->ActiveSrb, FDODeviceExtension->ResetInProgress, FDODeviceExtension->LastTimerActiveSrb);
358 if (FDODeviceExtension->ActiveSrb && FDODeviceExtension->ResetInProgress ==
FALSE && FDODeviceExtension->TimerWorkQueueEnabled)
360 if (FDODeviceExtension->LastTimerActiveSrb !=
NULL && FDODeviceExtension->LastTimerActiveSrb == FDODeviceExtension->ActiveSrb)
365 DPRINT1(
"[USBSTOR] ActiveSrb %p hang detected\n", FDODeviceExtension->ActiveSrb);
373 FDODeviceExtension->LastTimerActiveSrb = FDODeviceExtension->ActiveSrb;
381 FDODeviceExtension->LastTimerActiveSrb =
NULL;
390 if (
ResetDevice && FDODeviceExtension->TimerWorkQueueEnabled && FDODeviceExtension->SrbErrorHandlingActive ==
FALSE)
404 WorkItemData->
DeviceObject = FDODeviceExtension->FunctionalDeviceObject;
406 DPRINT1(
"[USBSTOR] Queing Timer WorkItem\n");
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define NT_SUCCESS(StatCode)
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
NTSTATUS USBSTOR_ResetPipeWithHandle(IN PDEVICE_OBJECT DeviceObject, IN USBD_PIPE_HANDLE PipeHandle)
VOID NTAPI USBSTOR_TimerWorkerRoutine(IN PVOID Context)
NTSTATUS USBSTOR_GetEndpointStatus(IN PDEVICE_OBJECT DeviceObject, IN UCHAR bEndpointAddress, OUT PUSHORT Value)
VOID NTAPI USBSTOR_TimerRoutine(PDEVICE_OBJECT DeviceObject, PVOID Context)
NTSTATUS USBSTOR_SyncUrbRequest(IN PDEVICE_OBJECT DeviceObject, OUT PURB UrbRequest)
NTSTATUS USBSTOR_ResetDevice(IN PDEVICE_OBJECT DeviceObject, IN PFDO_DEVICE_EXTENSION DeviceExtension)
VOID USBSTOR_QueueTerminateRequest(IN PDEVICE_OBJECT FDODeviceObject, IN PIRP Irp)
VOID USBSTOR_QueueNextRequest(IN PDEVICE_OBJECT DeviceObject)
VOID NTAPI ErrorHandlerWorkItemRoutine(PVOID Context)
VOID NTAPI USBSTOR_ResetHandlerWorkItemRoutine(PVOID Context)
NTSTATUS USBSTOR_HandleTransferError(PDEVICE_OBJECT DeviceObject, PIRP_CONTEXT Context)
#define ExAllocatePoolWithTag(hernya, size, tag)
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
VOID FreeItem(IN PVOID Item)
DWORD ResetDevice(DWORD private_handle)
#define ExFreePoolWithTag(_P, _T)
#define IoCompleteRequest
#define KeAcquireSpinLockAtDpcLevel(SpinLock)
#define KeReleaseSpinLockFromDpcLevel(SpinLock)
PUSBD_INTERFACE_INFORMATION InterfaceInformation
PDEVICE_OBJECT LowerDeviceObject
PFDO_DEVICE_EXTENSION FDODeviceExtension
PDEVICE_OBJECT DeviceObject
WORK_QUEUE_ITEM WorkQueueItem
COMMON_DEVICE_EXTENSION Common
struct _URB_PIPE_REQUEST UrbPipeRequest
#define STATUS_INSUFFICIENT_RESOURCES
NTSTATUS USBSTOR_HandleExecuteSCSI(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
VOID USBSTOR_SendCSW(PIRP_CONTEXT Context, PIRP Irp)
#define URB_FUNCTION_GET_STATUS_FROM_ENDPOINT
#define URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL
#define UsbBuildGetStatusRequest(urb, op, index, transferBuffer, transferBufferMDL, link)
struct _ERRORHANDLER_WORKITEM_DATA * PERRORHANDLER_WORKITEM_DATA
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
#define ExInitializeWorkItem(Item, Routine, Context)