All Sense/ASC/ASCQ data is cleared properly (#367)

* All Sense/ASC/ASCQ data is cleared properly

* Forgot to guard the status clear for REQUEST SENSE

Co-authored-by: Troy <jokker@gmail.com>
This commit is contained in:
Troy 2021-10-22 14:16:37 -04:00 committed by GitHub
parent ac4abbbe73
commit 40432c9de0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -355,6 +355,12 @@ void SASIDEV::Execute()
ctrl.blocks = 1; ctrl.blocks = 1;
ctrl.execstart = SysTimer::GetTimerLow(); ctrl.execstart = SysTimer::GetTimerLow();
// Discard pending sense data from the previous command if the current command is not REQUEST SENSE
if(SASIDEV::eCmdRequestSense != (SASIDEV::sasi_command)ctrl.cmd[0]) {
ctrl.status = 0;
ctrl.device->SetStatusCode(0);
}
// Process by command // Process by command
// TODO This code does not belong here. Each device type needs such a dispatcher, which the controller has to call. // TODO This code does not belong here. Each device type needs such a dispatcher, which the controller has to call.
switch ((SASIDEV::sasi_command)ctrl.cmd[0]) { switch ((SASIDEV::sasi_command)ctrl.cmd[0]) {

View File

@ -262,6 +262,11 @@ void SCSIDEV::Execute()
ctrl.device = ctrl.unit[lun]; ctrl.device = ctrl.unit[lun];
// Discard pending sense data from the previous command
if ((SCSIDEV::scsi_command)ctrl.cmd[0] != eCmdRequestSense) {
ctrl.device->SetStatusCode(0);
}
if (!ctrl.device->Dispatch(this)) { if (!ctrl.device->Dispatch(this)) {
LOGTRACE("ID %d LUN %d received unsupported command: $%02X", GetSCSIID(), lun, (BYTE)ctrl.cmd[0]); LOGTRACE("ID %d LUN %d received unsupported command: $%02X", GetSCSIID(), lun, (BYTE)ctrl.cmd[0]);