diff --git a/lib/SCSI2SD/include/scsi2sd.h b/lib/SCSI2SD/include/scsi2sd.h index c89f9f9a..1c1f99ec 100755 --- a/lib/SCSI2SD/include/scsi2sd.h +++ b/lib/SCSI2SD/include/scsi2sd.h @@ -89,7 +89,8 @@ typedef enum S2S_CFG_QUIRKS_OMTI = 2, S2S_CFG_QUIRKS_XEBEC = 4, S2S_CFG_QUIRKS_VMS = 8, - S2S_CFG_QUIRKS_X68000 = 16 + S2S_CFG_QUIRKS_X68000 = 16, + S2S_CFG_QUIRKS_EWSD = 32 } S2S_CFG_QUIRKS; typedef enum diff --git a/lib/SCSI2SD/src/firmware/scsi.c b/lib/SCSI2SD/src/firmware/scsi.c index 6122b444..03bc90af 100755 --- a/lib/SCSI2SD/src/firmware/scsi.c +++ b/lib/SCSI2SD/src/firmware/scsi.c @@ -142,6 +142,11 @@ void process_Status() { scsiEnterPhase(STATUS); + if (scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_EWSD) + { + s2s_delay_ms(1); + } + uint8_t message; uint8_t control = scsiDev.cdb[scsiDev.cdbLen - 1]; @@ -537,6 +542,12 @@ static void process_Command() scsiDev.data[7] = 10; // additional length scsiDev.data[12] = scsiDev.target->sense.asc >> 8; scsiDev.data[13] = scsiDev.target->sense.asc; + if ((scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_EWSD)) + { + /* EWSD seems not to want something behind additional length. (8 + 0x0e = 22) */ + allocLength=22; + scsiDev.data[7] = 0x0e; + } } // Silently truncate results. SCSI-2 spec 8.2.14. @@ -551,8 +562,15 @@ static void process_Command() // on receiving the unit attention response on boot, thus // triggering another unit attention condition. else if (scsiDev.target->unitAttention && - (scsiDev.boardCfg.flags & S2S_CFG_ENABLE_UNIT_ATTENTION)) + scsiDev.target->unitAttention_stop == 0 && + ((scsiDev.boardCfg.flags & S2S_CFG_ENABLE_UNIT_ATTENTION) || + (scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_EWSD))) { + /* EWSD requires unitAttention to be sent only once. */ + if (scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_EWSD) + { + scsiDev.target->unitAttention_stop = 1; + } scsiDev.target->sense.code = UNIT_ATTENTION; scsiDev.target->sense.asc = scsiDev.target->unitAttention; @@ -1280,7 +1298,13 @@ void scsiInit() scsiDev.targets[i].reserverId = -1; if (firstInit) { - scsiDev.targets[i].unitAttention = POWER_ON_RESET; + if ((cfg->deviceType == S2S_CFG_MO) && (scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_EWSD)) + { + scsiDev.targets[i].unitAttention = POWER_ON_RESET_OR_BUS_DEVICE_RESET_OCCURRED; + } else + { + scsiDev.targets[i].unitAttention = POWER_ON_RESET; + } } else { diff --git a/lib/SCSI2SD/src/firmware/scsi.h b/lib/SCSI2SD/src/firmware/scsi.h index 8c466bcb..14c772b9 100755 --- a/lib/SCSI2SD/src/firmware/scsi.h +++ b/lib/SCSI2SD/src/firmware/scsi.h @@ -102,6 +102,7 @@ typedef struct ScsiSense sense; uint16_t unitAttention; // Set to the sense qualifier key to be returned. + uint8_t unitAttention_stop; // Indicates if unit attention has to be stopped. // Only let the reserved initiator talk to us. // A 3rd party may be sending the RESERVE/RELEASE commands diff --git a/src/ZuluSCSI_disk.cpp b/src/ZuluSCSI_disk.cpp index 25918111..732f29c1 100644 --- a/src/ZuluSCSI_disk.cpp +++ b/src/ZuluSCSI_disk.cpp @@ -1113,6 +1113,10 @@ static void doReadCapacity() { uint32_t highestBlock = capacity - 1; + if (pmi && scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_EWSD) + { + highestBlock = 0x00001053; + } scsiDev.data[0] = highestBlock >> 24; scsiDev.data[1] = highestBlock >> 16; scsiDev.data[2] = highestBlock >> 8; diff --git a/zuluscsi.ini b/zuluscsi.ini index 8242478f..2f6a1290 100644 --- a/zuluscsi.ini +++ b/zuluscsi.ini @@ -17,7 +17,7 @@ # The PhyMode parameter has no effect on ZuluSCSI RP2040-based platforms, as there is only one PHY mode. # Settings that can be needed for compatibility with some hosts -#Quirks = 0 # 0: Standard, 1: Apple, 2: OMTI, 4: Xebec, 8: VMS, 16: X68000 +#Quirks = 0 # 0: Standard, 1: Apple, 2: OMTI, 4: Xebec, 8: VMS, 16: X68000, 32: EWSD #EnableUnitAttention = 0 # Post UNIT_ATTENTION status on power-on or SD card hotplug #EnableSCSI2 = 1 # Enable faster speeds of SCSI2 #EnableSelLatch = 0 # For Philips P2000C and other devices that release SEL signal before BSY