From 88ccca9f35dc815b2e72c79d4c91992c042c2c76 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 16 Oct 2017 20:58:43 +0200 Subject: [PATCH] The AHA and BusLogic SCSI controllers now only check for ID:0 when deciding on selection timeout, the LUN handling is done by the SCSI Command Phase 0 handler and returns CHECK CONDITION status with INVALID LUN sense if nothing is on present on that LUN. --- src/scsi/scsi_buslogic.c | 6 +++--- src/scsi/scsi_device.c | 2 +- src/scsi/scsi_x54x.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/scsi/scsi_buslogic.c b/src/scsi/scsi_buslogic.c index 4d8cc3756..206aa5590 100644 --- a/src/scsi/scsi_buslogic.c +++ b/src/scsi/scsi_buslogic.c @@ -578,12 +578,12 @@ BuslogicSCSIBIOSRequestSetup(x54x_t *dev, uint8_t *CmdBuf, uint8_t *DataInBuf, u SCSIStatus = SCSI_STATUS_OK; - if (!scsi_device_present(ESCSICmd->TargetId, ESCSICmd->LogicalUnit)) { - buslogic_log("SCSI Target ID %i and LUN %i have no device attached\n",ESCSICmd->TargetId,ESCSICmd->LogicalUnit); + if (!scsi_device_present(ESCSICmd->TargetId, 0)) { + buslogic_log("SCSI Target ID %i has no device attached\n",ESCSICmd->TargetId,ESCSICmd->LogicalUnit); DataInBuf[2] = CCB_SELECTION_TIMEOUT; DataInBuf[3] = SCSI_STATUS_OK; } else { - buslogic_log("SCSI Target ID %i and LUN %i detected and working\n", ESCSICmd->TargetId, ESCSICmd->LogicalUnit); + buslogic_log("SCSI Target ID %i detected and working\n", ESCSICmd->TargetId, ESCSICmd->LogicalUnit); buslogic_log("Transfer Control %02X\n", ESCSICmd->DataDirection); buslogic_log("CDB Length %i\n", ESCSICmd->CDBLength); diff --git a/src/scsi/scsi_device.c b/src/scsi/scsi_device.c index 75a63ab8d..73e3e0789 100644 --- a/src/scsi/scsi_device.c +++ b/src/scsi/scsi_device.c @@ -27,7 +27,7 @@ #include "scsi_disk.h" -static uint8_t scsi_null_device_sense[14] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; +static uint8_t scsi_null_device_sense[14] = { 0x70,0,SENSE_ILLEGAL_REQUEST,0,0,0,0,0,0,0,0,0,ASC_INV_LUN,0 }; static void scsi_device_target_command(int lun_type, uint8_t id, uint8_t *cdb) diff --git a/src/scsi/scsi_x54x.c b/src/scsi/scsi_x54x.c index bfb091ddd..cc2a982cc 100644 --- a/src/scsi/scsi_x54x.c +++ b/src/scsi/scsi_x54x.c @@ -1033,9 +1033,8 @@ x54x_scsi_cmd(x54x_t *dev) SenseBufferFree(req, (SCSIStatus != SCSI_STATUS_OK)); } - } else { + } else SenseBufferFree(req, (SCSIStatus != SCSI_STATUS_OK)); - } x54x_set_residue(req, target_data_len); @@ -1103,14 +1102,15 @@ x54x_req_setup(x54x_t *dev, uint32_t CCBPointer, Mailbox32_t *Mailbox32) SCSIStatus = SCSI_STATUS_OK; - if (! scsi_device_present(id, lun)) { + /* If there is no device at ID:0, timeout the selection - the LUN is then checked later. */ + if (! scsi_device_present(id, 0)) { x54x_log("SCSI Target ID %i and LUN %i have no device attached\n",id,lun); x54x_mbi_setup(dev, CCBPointer, &req->CmdBlock, CCB_SELECTION_TIMEOUT, SCSI_STATUS_OK, MBI_ERROR); x54x_log("%s: Callback: Send incoming mailbox\n", dev->name); x54x_notify(dev); } else { - x54x_log("SCSI Target ID %i and LUN %i detected and working\n", id, lun); + x54x_log("SCSI Target ID %i detected and working\n", id); x54x_log("Transfer Control %02X\n", req->CmdBlock.common.ControlByte); x54x_log("CDB Length %i\n", req->CmdBlock.common.CdbLength);