SENSE CODES in a SCSI miniport driver

hi anton & others,

While scanning a scsiminiport diver… ( for checking virtual device presence )… We r sending SrbStatus = SRB_STATUS_SUCCESS , and filling up the inquiry data…

now… if the device is not present… what should we send to the scsiport in SrbBuffer and SenseBuffer… ???

I’m sending the data as below… is it correct ???

if ( device_present )
{


case SCSIOP_INQUIRY:

… // filled required data;
SrbStatus = SRB_STATUS_SUCCESS

else if ( Srb->PathId >= MAX_PATHID )
{
Srb->ScsiStatus = SCSISTAT_CHECK_CONDITION;
luExtension->SenseData.SenseKey = SCSI_SENSE_HARDWARE_ERROR;
luExtension->SenseData.AdditionalSenseCode = SCSI_ADSENSE_ILLEGAL_COMMAND;
Srb->SrbStatus = SRB_STATUS_INVALID_PATH_ID; if ((Srb->SrbFlags & SRB_FLAGS_DISABLE_AUTOSENSE) == 0)
{
if (Srb->SenseInfoBuffer != NULL)
memcpy(Srb->SenseInfoBuffer, &(luExtension->SenseData), sizeof(SENSE_DATA));
Srb->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID;
}
luExtension->ActiveLuRequest->DataTransferLength = 0;
}
else if ( Srb->TargetId >= MAX_TARGET )
{
Srb->ScsiStatus = SCSISTAT_CHECK_CONDITION;
luExtension->SenseData.SenseKey = SCSI_SENSE_ILLEGAL_REQUEST;
luExtension->SenseData.AdditionalSenseCode = SCSI_ADSENSE_ILLEGAL_COMMAND;
Srb->SrbStatus = SRB_STATUS_INVALID_TARGET_ID;
if ((Srb->SrbFlags & SRB_FLAGS_DISABLE_AUTOSENSE) == 0)
{
if (Srb->SenseInfoBuffer != NULL)
memcpy(Srb->SenseInfoBuffer, &(luExtension->SenseData), sizeof(SENSE_DATA));
Srb->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID;
}
luExtension->ActiveLuRequest->DataTransferLength = 0;
}
else
{
Srb->SrbStatus = SRB_STATUS_ERROR;
Srb->ScsiStatus = SCSISTAT_CHECK_CONDITION;
luExtension->SenseData.SenseKey = SCSI_SENSE_NO_SENSE;
luExtension->SenseData.AdditionalSenseCode = SCSI_ADSENSE_NO_SENSE;

if ((Srb->SrbFlags & SRB_FLAGS_DISABLE_AUTOSENSE) == 0)
{
if (Srb->SenseInfoBuffer != NULL)
memcpy(Srb->SenseInfoBuffer, &(luExtension->SenseData), sizeof(SENSE_DATA));
Srb->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID;
}
luExtension->ActiveLuRequest->DataTransferLength = 0;
}



…this code sometimes gives a ‘pagefault’ is the VXD ‘IOS’ …

what should I send here ???

thanks in Advance

raj


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

If the LUN is not there - you must fail any SRBs with SRB_STATUS_SELECTION_TIMEOUT.

Max

----- Original Message -----
From: Somsubhra Raj
To: NT Developers Interest List
Sent: Thursday, October 18, 2001 8:23 AM
Subject: [ntdev] SENSE CODES in a SCSI miniport driver

hi anton & others,

While scanning a scsiminiport diver… ( for checking virtual device presence )… We r sending SrbStatus = SRB_STATUS_SUCCESS , and filling up the inquiry data…

now… if the device is not present… what should we send to the scsiport in SrbBuffer and SenseBuffer… ???

I’m sending the data as below… is it correct ???

if ( device_present )
{


case SCSIOP_INQUIRY:

… // filled required data;
SrbStatus = SRB_STATUS_SUCCESS

else if ( Srb->PathId >= MAX_PATHID )
{
Srb->ScsiStatus = SCSISTAT_CHECK_CONDITION;
luExtension->SenseData.SenseKey = SCSI_SENSE_HARDWARE_ERROR;
luExtension->SenseData.AdditionalSenseCode = SCSI_ADSENSE_ILLEGAL_COMMAND;
Srb->SrbStatus = SRB_STATUS_INVALID_PATH_ID; if ((Srb->SrbFlags & SRB_FLAGS_DISABLE_AUTOSENSE) == 0)
{
if (Srb->SenseInfoBuffer != NULL)
memcpy(Srb->SenseInfoBuffer, &(luExtension->SenseData), sizeof(SENSE_DATA));
Srb->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID;
}
luExtension->ActiveLuRequest->DataTransferLength = 0;
}
else if ( Srb->TargetId >= MAX_TARGET )
{
Srb->ScsiStatus = SCSISTAT_CHECK_CONDITION;
luExtension->SenseData.SenseKey = SCSI_SENSE_ILLEGAL_REQUEST;
luExtension->SenseData.AdditionalSenseCode = SCSI_ADSENSE_ILLEGAL_COMMAND;
Srb->SrbStatus = SRB_STATUS_INVALID_TARGET_ID;
if ((Srb->SrbFlags & SRB_FLAGS_DISABLE_AUTOSENSE) == 0)
{
if (Srb->SenseInfoBuffer != NULL)
memcpy(Srb->SenseInfoBuffer, &(luExtension->SenseData), sizeof(SENSE_DATA));
Srb->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID;
}
luExtension->ActiveLuRequest->DataTransferLength = 0;
}
else
{
Srb->SrbStatus = SRB_STATUS_ERROR;
Srb->ScsiStatus = SCSISTAT_CHECK_CONDITION;
luExtension->SenseData.SenseKey = SCSI_SENSE_NO_SENSE;
luExtension->SenseData.AdditionalSenseCode = SCSI_ADSENSE_NO_SENSE;

if ((Srb->SrbFlags & SRB_FLAGS_DISABLE_AUTOSENSE) == 0)
{
if (Srb->SenseInfoBuffer != NULL)
memcpy(Srb->SenseInfoBuffer, &(luExtension->SenseData), sizeof(SENSE_DATA));
Srb->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID;
}
luExtension->ActiveLuRequest->DataTransferLength = 0;
}



…this code sometimes gives a ‘pagefault’ is the VXD ‘IOS’ …

what should I send here ???

thanks in Advance

raj

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com