3592 PCDB cdb = (
PCDB)DeviceExtension->PowerContext.Srb.Cdb;
3593 ULONG timeoutValue = DeviceExtension->TimeOutValue;
3594 ULONG retryCount = 1;
3597 DeviceExtension->PowerContext.RetryIntervalIn100ns = 0;
3598 status = PowerContextReuseRequest(DeviceExtension);
3607 switch(DeviceExtension->PowerContext.PowerChangeState.PowerDown)
3618 timeoutValue = DeviceExtension->TimeOutValue;
3626 ULONG secondsRemaining = 0;
3628 #if (WINVER >= 0x0601) 3630 PoQueryWatchdogTime(DeviceExtension->LowerPdo, &secondsRemaining);
3633 if (secondsRemaining == 0)
3642 if (secondsRemaining >= 32)
3652 if (retryCount == 1)
3654 timeoutValue = secondsRemaining - 30;
3672 DeviceExtension->PowerContext.RetryCount = retryCount;
3686 DeviceExtension->PowerContext.Srb.TimeOutValue = timeoutValue;
3699 DeviceExtension->PowerContext.Srb.CdbLength = 10;
3705 DeviceExtension->PowerContext.Srb.CdbLength = 6;
3718 WdfRequestSetCompletionRoutine(DeviceExtension->PowerContext.PowerRequest,
3724 DeviceExtension->PowerContext.PowerRequest,
3725 DeviceExtension->IoTarget,
3736 "%p\tError occured when issuing %s command to device. Srb %p, Status %x\n",
3737 DeviceExtension->PowerContext.PowerRequest,
3738 (DeviceExtension->PowerContext.PowerChangeState.PowerDown ==
PowerDownDeviceQuiesced) ?
"SYNC CACHE" :
"STOP UNIT",
3739 &DeviceExtension->PowerContext.Srb,
3740 DeviceExtension->PowerContext.Srb.SrbStatus));
3745 DeviceExtension->PowerContext.PowerRequest,
3746 &(DeviceExtension->PowerContext.Srb),
3747 retryCount - DeviceExtension->PowerContext.RetryCount,
3749 &(DeviceExtension->PowerContext.RetryIntervalIn100ns));
3751 if (shouldRetry && (DeviceExtension->PowerContext.RetryCount-- == 0))
3753 shouldRetry =
FALSE;
3759 shouldRetry =
FALSE;
3766 shouldRetry =
FALSE;
3772 t.QuadPart = -DeviceExtension->PowerContext.RetryIntervalIn100ns;
3775 status = PowerContextReuseRequest(DeviceExtension);
3778 shouldRetry =
FALSE;
#define SRB_FUNCTION_UNLOCK_QUEUE
#define SCSIOP_SYNCHRONIZE_CACHE
#define SRB_FUNCTION_QUIESCE_DEVICE
#define SRB_FLAGS_NO_QUEUE_FREEZE
struct _CDB::_SYNCHRONIZE_CACHE10 SYNCHRONIZE_CACHE10
#define SRB_STATUS(Status)
VOID RequestClearSendTime(_In_ WDFREQUEST Request)
return STATUS_NOT_IMPLEMENTED
#define SCSI_CDROM_TIMEOUT
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
#define SRB_FLAGS_BYPASS_LOCKED_QUEUE
struct _CDB::_START_STOP START_STOP
VOID NTAPI KeQueryTickCount(IN PLARGE_INTEGER TickCount)
#define TEST_FLAG(Flags, Bit)
#define NT_SUCCESS(StatCode)
#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER
#define SRB_FLAGS_NO_DATA_TRANSFER
BOOLEAN RequestSenseInfoInterpret(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ PSCSI_REQUEST_BLOCK Srb, _In_ ULONG RetriedCount, _Out_ NTSTATUS *Status, _Out_opt_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG *RetryIntervalIn100ns)
#define SRB_STATUS_QUEUE_FROZEN
NTSTATUS RequestSend(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ WDFIOTARGET IoTarget, _In_ ULONG Flags, _Out_opt_ PBOOLEAN RequestSent)
#define TRACE_LEVEL_ERROR
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine
#define SRB_FUNCTION_EXECUTE_SCSI
#define SRB_STATUS_SUCCESS
#define SRB_FLAGS_D3_PROCESSING
static SERVICE_STATUS status
#define SCSIOP_START_STOP_UNIT
#define SRB_FUNCTION_LOCK_QUEUE