2186 PDEVICE_EXTENSION physicalExtension = deviceExtension->PhysicalDevice->DeviceExtension;
2190 ULONG badSector = 0;
2208 for (
i = 1;
i < 12;
i++) {
2217 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Error code is %x\n",
2219 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Sense key is %x\n",
2221 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Additional sense code is %x\n",
2223 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Additional sense code qualifier is %x\n",
2234 if (readSector >
Srb->SenseInfoBufferLength) {
2235 readSector =
Srb->SenseInfoBufferLength;
2246 switch (senseBuffer->
SenseKey & 0xf) {
2250 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Device not ready\n"));
2257 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Lun not ready\n"));
2263 DebugPrint((1,
"ScsiClassInterpretSenseInfo:" 2264 " In process of becoming ready\n"));
2269 DebugPrint((1,
"ScsiClassInterpretSenseInfo:" 2270 " Manual intervention required\n"));
2277 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Format in progress\n"));
2285 DebugPrint((1,
"ScsiClassInterpretSenseInfo:" 2286 " Initializing command required\n"));
2308 "ScsiClassInterpretSenseInfo:" 2309 " No Media in device.\n"));
2317 if((deviceExtension->MediaChangeEvent !=
NULL)&&
2318 (!deviceExtension->MediaChangeNoMedia)) {
2319 KeSetEvent(deviceExtension->MediaChangeEvent,
2322 DebugPrint((0,
"ScsiClassInterpretSenseInfo:" 2323 "Detected No Media In Device " 2324 "[irp = 0x%lx]\n",
Srb->OriginalRequest));
2325 deviceExtension->MediaChangeNoMedia =
TRUE;
2335 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Media write protected\n"));
2342 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Bad media\n"));
2353 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Hardware error\n"));
2364 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Illegal SCSI request\n"));
2370 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Illegal command\n"));
2375 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Illegal block address\n"));
2381 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Invalid LUN\n"));
2387 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Music area\n"));
2392 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Data area\n"));
2397 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Volume overflow\n"));
2402 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Invalid CDB\n"));
2431 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Media changed\n"));
2433 if(deviceExtension->MediaChangeEvent !=
NULL) {
2435 KeSetEvent(deviceExtension->MediaChangeEvent,
2438 DebugPrint((0,
"ScsiClassInterpretSenseInfo:" 2439 "New Media Found - Setting MediaChanged event" 2440 " [irp = 0x%lx]\n",
Srb->OriginalRequest));
2441 deviceExtension->MediaChangeNoMedia =
FALSE;
2447 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Bus reset\n"));
2451 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Unit attention\n"));
2480 physicalExtension->MediaChangeCount++;
2482 DebugPrint((2,
"ScsiClassInterpretSenseInfo - Media change " 2483 "count for device %d is %d\n",
2484 physicalExtension->DeviceNumber,
2485 physicalExtension->MediaChangeCount));
2491 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Command aborted\n"));
2497 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Recovered error\n"));
2522 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Incorrect length detected.\n"));
2536 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Incorrect length detected.\n"));
2542 DebugPrint((1,
"ScsiClassInterpretSenseInfo: No specific sense key\n"));
2551 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Unrecognized sense code\n"));
2571 readSector = (readSector << 8) |
Srb->Cdb[
index+2];
2574 index = (((
PCDB)
Srb->Cdb)->CDB10.TransferBlocksMsb << 8) |
2575 ((
PCDB)
Srb->Cdb)->CDB10.TransferBlocksLsb;
2581 if (!(badSector >= readSector && badSector < readSector +
index)) {
2582 badSector = readSector;
2593 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Request sense info not valid. SrbStatus %2x\n",
2615 deviceExtension->ErrorCount++;
2638 deviceExtension->ErrorCount++;
2646 if (RetryCount > 1 ) {
2687 deviceExtension->ErrorCount++;
2700 if (
Srb->ScsiStatus == 0) {
2707 deviceExtension->ErrorCount++;
2737 if (deviceExtension->ErrorCount == 4) {
2748 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Too many errors disabling tagged queuing and synchronous data tranfers.\n"));
2750 }
else if (deviceExtension->ErrorCount == 8) {
2757 DebugPrint((1,
"ScsiClassInterpretSenseInfo: Too many errors disabling disconnects.\n"));
2765 if (deviceExtension->ClassError !=
NULL) {
2783 if (errorLogEntry ==
NULL) {
2803 if (deviceExtension->DiskGeometry !=
NULL) {
2808 deviceExtension->DiskGeometry->Geometry.BytesPerSector);
2822 errorLogEntry->
DumpData[4] =
Srb->SrbStatus << 8 |
Srb->ScsiStatus;
2824 if (senseBuffer !=
NULL) {
#define SRB_STATUS_INVALID_REQUEST
#define SRB_STATUS_BUS_RESET
#define SCSI_SENSEQ_FORMAT_IN_PROGRESS
#define STATUS_NO_MEDIA_IN_DEVICE
#define STATUS_DATA_OVERRUN
#define SRB_STATUS_AUTOSENSE_VALID
#define SRB_FLAGS_NO_QUEUE_FREEZE
#define SRB_STATUS_REQUEST_FLUSHED
#define SCSI_ADSENSE_MUSIC_AREA
#define SCSI_ADSENSE_DATA_AREA
#define SRB_STATUS_COMMAND_TIMEOUT
#define STATUS_INVALID_DEVICE_REQUEST
#define SRB_STATUS_NO_DEVICE
#define SRB_STATUS_PHASE_SEQUENCE_FAILURE
#define SCSI_ADSENSE_LUN_NOT_READY
#define STATUS_VERIFY_REQUIRED
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
#define SCSI_SENSE_NOT_READY
#define SRB_STATUS_INVALID_TARGET_ID
#define SRB_STATUS(Status)
#define STATUS_INVALID_BLOCK_LENGTH
VOID NTAPI IoWriteErrorLogEntry(IN PVOID ElEntry)
LARGE_INTEGER DeviceOffset
#define STATUS_NONEXISTENT_SECTOR
#define SCSI_ADSENSE_VOLUME_OVERFLOW
#define STATUS_IO_DEVICE_ERROR
#define SCSI_SENSE_MEDIUM_ERROR
_In_ PDEVICE_OBJECT DeviceObject
#define SCSI_ADSENSE_REC_DATA_NOECC
#define SRB_STATUS_PARITY_ERROR
#define SCSI_SENSEQ_MANUAL_INTERVENTION_REQUIRED
#define FILE_REMOVABLE_MEDIA
#define SCSI_ADSENSE_NO_MEDIA_IN_DEVICE
#define SRB_STATUS_NO_HBA
#define SRB_STATUS_ABORTED
#define STATUS_MEDIA_WRITE_PROTECTED
#define DEV_SAFE_START_UNIT
_In_ UCHAR _Out_opt_ PUCHAR _Out_opt_ PUCHAR _Out_opt_ PUCHAR AdditionalSenseCodeQualifier
#define STATUS_DEVICE_NOT_CONNECTED
PVOID NTAPI IoAllocateErrorLogEntry(IN PVOID IoObject, IN UCHAR EntrySize)
UCHAR AdditionalSenseCodeQualifier
#define SCSI_ADSENSE_SEEK_ERROR
#define SCSI_ADSENSE_ILLEGAL_BLOCK
#define SCSI_SENSEQ_BECOMING_READY
#define STATUS_NO_SUCH_DEVICE
#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER
#define SCSI_ADSENSE_REC_DATA_ECC
#define SCSISTAT_RESERVATION_CONFLICT
_In_opt_ PIRP _In_ PSCSI_REQUEST_BLOCK _In_ UCHAR MajorFunctionCode
#define SRB_STATUS_DATA_OVERRUN
NTSYSAPI LONGLONG WINAPI RtlExtendedIntegerMultiply(LONGLONG, INT)
#define SCSI_SENSE_HARDWARE_ERROR
#define SRB_FLAGS_DISABLE_DISCONNECT
#define SCSI_ADSENSE_BUS_RESET
#define SRB_STATUS_SELECTION_TIMEOUT
#define SCSI_SENSE_RECOVERED_ERROR
#define SCSI_SENSE_ABORTED_COMMAND
#define SCSI_SENSE_NO_SENSE
#define SRB_STATUS_INVALID_LUN
ULONG NTAPI DebugPrint(IN PSTRING DebugString, IN ULONG ComponentId, IN ULONG Level)
#define SCSI_SENSEQ_INIT_COMMAND_REQUIRED
VOID NTAPI StartUnit(IN PDEVICE_OBJECT DeviceObject)
_In_ UCHAR _Out_opt_ PUCHAR _Out_opt_ PUCHAR AdditionalSenseCode
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define SRB_STATUS_TIMEOUT
#define STATUS_DEVICE_BUSY
#define FIELD_OFFSET(t, f)
#define STATUS_IO_TIMEOUT
struct _IO_ERROR_LOG_PACKET * PIO_ERROR_LOG_PACKET
#define SCSI_ADSENSE_INVALID_LUN
#define SCSI_ADSENSE_TRACK_ERROR
#define SRB_STATUS_UNEXPECTED_BUS_FREE
#define SCSI_SENSE_DATA_PROTECT
UCHAR AdditionalSenseLength
#define SRB_STATUS_INVALID_PATH_ID
IN PSCSI_REQUEST_BLOCK Srb
UCHAR AdditionalSenseCode
#define SCSI_SENSE_ILLEGAL_REQUEST
#define SCSI_ADSENSE_ILLEGAL_COMMAND
#define SCSI_SENSE_UNIT_ATTENTION
#define SCSI_ADSENSE_INVALID_CDB
#define STATUS_DEVICE_DATA_ERROR
#define SRB_FLAGS_QUEUE_ACTION_ENABLE
_In_opt_ PIRP _In_ PSCSI_REQUEST_BLOCK _In_ UCHAR _In_ ULONG IoDeviceCode
#define STATUS_DEVICE_NOT_READY
#define SCSI_ADSENSE_MEDIUM_CHANGED