41{
44 ULONG timesAlreadyRetried;
47
48
49
50
51 Pkt->RetryIn100nsUnits = 0;
52
53
54
55
56
57
59 {
60 TracePrint((
TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL,
"Unhandled SRB Function %xh in error path for packet %p (did miniport change Srb.Cdb.OperationCode ?)", (
ULONG)pCdb->
CDB10.OperationCode,
Pkt));
61 }
62
64
67
68
70
71
72
73
74
75
80 srbPtr = &tempSrb;
81 }
82
85 srbPtr,
87 0,
88 timesAlreadyRetried,
91 &
Pkt->RetryIn100nsUnits);
92
93
94 } else {
95
96
97
98
99
100
106 UCHAR additionalSenseQual = 0;
107
109
111 senseInfoBufferLength,
115 &additionalSenseQual);
116
118
119 ULONG retryIntervalSeconds = 0;
120
121
122
127 0,
128 timesAlreadyRetried,
130 &retryIntervalSeconds);
131
132 if (shouldRetry) {
133
134
135
137
139
142 setRetryIntervalSeconds =
TRUE;
143 }
144 }
145
147 setRetryIntervalSeconds =
TRUE;
148 }
149
150 if (setRetryIntervalSeconds) {
151 retryIntervalSeconds =
MAX(retryIntervalSeconds, 2);
152 }
153 }
154
155 if (shouldRetry)
156 {
157 Pkt->RetryIn100nsUnits = retryIntervalSeconds;
158 Pkt->RetryIn100nsUnits *= 1000 * 1000 * 10;
159 }
160
161 }
164
165 ULONG retryIntervalSeconds = 0;
166
167
168
173 0,
174 timesAlreadyRetried,
176 &retryIntervalSeconds);
177 if (shouldRetry) {
178
179
180
182
186 setRetryIntervalSeconds =
TRUE;
187 }
188 }
189
191 setRetryIntervalSeconds =
TRUE;
192 }
193
194 if (setRetryIntervalSeconds) {
195 retryIntervalSeconds =
MAX(retryIntervalSeconds, 2);
196 }
197 }
198
199
200
201
204 }
206
207
208
209
210
211
212
213
216 }
217
218 if (shouldRetry)
219 {
220 Pkt->RetryIn100nsUnits = retryIntervalSeconds;
221 Pkt->RetryIn100nsUnits *= 1000 * 1000 * 10;
222 }
223
224 }
227
228 ULONG retryIntervalSeconds = 0;
229
230
231
232
237 0,
238 timesAlreadyRetried,
240 &retryIntervalSeconds);
243 }
244#if (NTDDI_VERSION >= NTDDI_WINBLUE)
245 else if (ClasspSrbTimeOutStatus(
Pkt->
Srb)) {
246
248
249 if (shouldRetry) {
250
251
252
253
254
257 } else {
259
260
261
262 }
263 }
264 }
265#endif
266
267 if (shouldRetry)
268 {
269 Pkt->RetryIn100nsUnits = retryIntervalSeconds;
270 Pkt->RetryIn100nsUnits *= 1000 * 1000 * 10;
271 }
272
273 }
275
276 ULONG retryIntervalSeconds = 0;
277
278
279
281
285 0,
286 timesAlreadyRetried,
288 &retryIntervalSeconds);
289
290
291
292
294
295
296
297
299 }
302
303
304
305
308
309 }
310#if (NTDDI_VERSION >= NTDDI_WINBLUE)
311 else if (ClasspSrbTimeOutStatus(
Pkt->
Srb)) {
312
314
315 if (shouldRetry) {
316
317
318
319
320
323 } else {
325
326
327
328 }
329 }
330 }
331#endif
332
333 if (shouldRetry)
334 {
335 Pkt->RetryIn100nsUnits = retryIntervalSeconds;
336 Pkt->RetryIn100nsUnits *= 1000 * 1000 * 10;
337 }
338
340
341 ULONG retryIntervalSeconds = 0;
342
344
349 0,
350 timesAlreadyRetried,
352 &retryIntervalSeconds);
353
354 if (shouldRetry) {
355
356 Pkt->RetryIn100nsUnits = retryIntervalSeconds;
357 Pkt->RetryIn100nsUnits *= 1000 * 1000 * 10;
358
359 } else {
360
362
365
367
368
369
370
371
374
375
376
377
379
381 UCHAR startBufferLength = 0;
382
383
386 &startBuffer,
387 &startBufferLength)) {
390 UCHAR outBufferLength = 0;
391
393
394 if (ScsiGetNextSenseDescriptorByType(startBuffer,
395 startBufferLength,
396 typeList,
398 &outType,
400 &outBufferLength)) {
401
403
404 if (ScsiValidateInformationSenseDescriptor(
outBuffer, outBufferLength)) {
406 isInformationValid =
TRUE;
407 }
408
409 } else {
410
411
412
413
415 }
416 }
417 }
418 } else {
419
420
421
422
424 isInformationValid =
TRUE;
425 }
426
427 if (isInformationValid) {
429 }
430 }
431 }
432 }
433 }
434
435 }
436 else {
437 TracePrint((
TRACE_LEVEL_ERROR, TRACE_FLAG_GENERAL,
"Unhandled SRB Function %xh in error path for packet %p (did miniport change Srb.Cdb.OperationCode ?)", (
ULONG)pCdb->
CDB10.OperationCode,
Pkt));
438 }
439 }
440
441 return shouldRetry;
442}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define IS_SCSIOP_READWRITE(opCode)
#define TEST_FLAG(Flags, Bit)
#define SCSI_ADSENSE_LUN_NOT_READY
#define SCSIOP_MODE_SENSE10
#define SCSI_SENSE_COPY_ABORTED
#define SCSIOP_MEDIUM_REMOVAL
#define SCSIOP_READ_CAPACITY
#define SCSIOP_MODE_SENSE
#define SCSI_SENSE_ABORTED_COMMAND
FORCEINLINE BOOLEAN ClasspIsOffloadDataTransferCommand(_In_ PCDB Cdb)
FORCEINLINE PVOID ClasspTransferPacketGetSenseInfoBuffer(_In_ PTRANSFER_PACKET Pkt)
FORCEINLINE BOOLEAN ClasspIsTokenOperation(_In_ PCDB Cdb)
FORCEINLINE BOOLEAN ClasspTransferPacketGetNumberOfRetriesDone(_In_ PTRANSFER_PACKET Pkt, _In_ PCDB Cdb, _Out_ PULONG TimesAlreadyRetried)
FORCEINLINE PCDB ClasspTransferPacketGetCdb(_In_ PTRANSFER_PACKET Pkt)
VOID ClasspConvertToScsiRequestBlock(_Out_ PSCSI_REQUEST_BLOCK Srb, _In_ PSTORAGE_REQUEST_BLOCK SrbEx)
FORCEINLINE UCHAR ClasspTransferPacketGetSenseInfoBufferLength(_In_ PTRANSFER_PACKET Pkt)
#define CLASS_SRB_STORAGE_REQUEST_BLOCK
static PDB_INFORMATION information
BOOLEAN NTAPI ClassInterpretSenseInfo(_In_ PDEVICE_OBJECT Fdo, _In_ PSCSI_REQUEST_BLOCK _Srb, _In_ UCHAR MajorFunctionCode, _In_ ULONG IoDeviceCode, _In_ ULONG RetryCount, _Out_ NTSTATUS *Status, _Out_opt_ _Deref_out_range_(0, 100) ULONG *RetryInterval)
#define SRB_STATUS_DATA_OVERRUN
struct _SCSI_REQUEST_BLOCK * PSCSI_REQUEST_BLOCK
#define SRB_STATUS_SELECTION_TIMEOUT
#define SRB_STATUS(Status)
UCHAR additionalSenseCode
#define SCSI_SENSE_DESCRIPTOR_TYPE_INFORMATION
#define SCSI_SENSE_OPTIONS_FIXED_FORMAT_IF_UNKNOWN_FORMAT_INDICATED
#define REVERSE_BYTES_QUAD(Destination, Source)
PFIXED_SENSE_DATA senseInfoBuffer
#define SCSI_ADSENSE_COPY_TARGET_DEVICE_ERROR
#define SCSIOP_READ_CAPACITY16
#define SCSI_SENSEQ_DATA_UNDERRUN
#define REVERSE_BYTES(Destination, Source)
PFIXED_SENSE_DATA outBuffer
#define IsDescriptorSenseDataFormat(SenseInfoBuffer)
#define SRB_FUNCTION_STORAGE_REQUEST_BLOCK
#define STATUS_DEVICE_NOT_READY
FORCEINLINE UCHAR SrbGetSenseInfoBufferLength(_In_ PVOID Srb)
#define TRACE_LEVEL_ERROR
__callback PCLASS_INTERPRET_SENSE_INFO Interpret
PCLASS_INTERPRET_SENSE_INFO2 InterpretSenseInfo
PCLASS_DRIVER_EXTENSION DriverExtension
COMMON_DEVICE_EXTENSION CommonExtension
PSTORAGE_REQUEST_BLOCK_HEADER Srb
UCHAR NumIoTimeoutRetries
PSRB_HISTORY RetryHistory
#define STATUS_IO_DEVICE_ERROR
#define STATUS_VERIFY_REQUIRED
#define STATUS_INSUFFICIENT_RESOURCES
struct _CDB::_CDB10 CDB10
struct _CDB::_MEDIA_REMOVAL MEDIA_REMOVAL
struct _CDB::_MODE_SENSE MODE_SENSE
struct _CDB::_CDB16 CDB16
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
#define SL_OVERRIDE_VERIFY_VOLUME