ソースを参照

Add X86800 quirk for odd 0x00 CBD opcode

Fix by @aotta
https://github.com/BlueSCSI/BlueSCSI-v2/pull/102

Adds a new quirk setting to `zuluscsi.ini` which should be applied by
setting
```
[SCSI]
System = X68000
```
but can also be applied by setting
```
[SCSI]
Quirks = 16
```

Apparently X68000 system send a SCSI opcode 0x00 which is normally
an error. This quirk setting catches the opcode and sends the
proper response.

Co-authored-by:  Andrea Ottaviani <andrea.ottaviani.69@gmail.com>
Morio 1 年間 前
コミット
a8437a5922

+ 1 - 1
lib/SCSI2SD/include/scsi2sd.h

@@ -89,7 +89,7 @@ typedef enum
 	S2S_CFG_QUIRKS_OMTI = 2,
 	S2S_CFG_QUIRKS_XEBEC = 4,
 	S2S_CFG_QUIRKS_VMS = 8,
-	S2S_CFG_QUIRKS_EMU = 9
+	S2S_CFG_QUIRKS_X68000 = 16
 } S2S_CFG_QUIRKS;
 
 typedef enum

+ 1 - 1
lib/SCSI2SD/src/firmware/inquiry.c

@@ -163,7 +163,7 @@ void s2s_scsiInquiry()
 	{
 		// VAX workaround
 		if (allocationLength == 255 &&
-			(scsiDev.target->cfg->quirks & S2S_CFG_QUIRKS_VMS))
+			(scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_VMS))
 		{
 			allocationLength = 254;
 		}

+ 18 - 0
lib/SCSI2SD/src/firmware/scsi.c

@@ -1,5 +1,6 @@
 //	Copyright (C) 2014 Michael McMaster <michael@codesrc.com>
 //	Copyright (c) 2023 joshua stein <jcs@jcs.org>
+//  Copyright (c) 2023 Andrea Ottaviani <andrea.ottaviani.69@gmail.com>
 //
 //	This file is part of SCSI2SD.
 //
@@ -355,6 +356,23 @@ static void process_Command()
 		memset(scsiDev.cdb, 0xff, sizeof(scsiDev.cdb));
 		return;
 	}
+	// X68000 and strange "0x00 0xXX .. .. .. .." command
+	else if ((command == 0x00) && likely(scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_X68000))
+	{
+		if (scsiDev.cdb[1] == 0x28)
+		{
+			scsiDev.target->sense.code = NO_SENSE;
+			scsiDev.target->sense.asc = NO_ADDITIONAL_SENSE_INFORMATION;
+			enter_Status(CHECK_CONDITION);
+			return;
+		} 	else if (scsiDev.cdb[1] == 0x03)
+		{
+			scsiDev.target->sense.code = NO_SENSE;
+			scsiDev.target->sense.asc = NO_ADDITIONAL_SENSE_INFORMATION;
+			enter_Status(GOOD);
+			return;
+		}
+	}
 	else if (parityError &&
 		(scsiDev.boardCfg.flags & S2S_CFG_ENABLE_PARITY))
 	{

+ 1 - 1
src/ZuluSCSI_settings.cpp

@@ -341,7 +341,7 @@ scsi_system_settings_t *ZuluSCSISettings::initSystem(const char *presetName)
     {
         m_sysPreset = SYS_PRESET_X68000;
         cfgSys.selectionDelay = 0;
-        cfgSys.quirks = S2S_CFG_QUIRKS_NONE;
+        cfgSys.quirks = S2S_CFG_QUIRKS_X68000;
         cfgSys.enableSCSI2 = false;
         cfgSys.maxSyncSpeed = 5;
     }

+ 1 - 1
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
+#Quirks = 0   # 0: Standard, 1: Apple, 2: OMTI, 4: Xebec, 8: VMS, 16: X68000
 #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