Skip to content

Commit

Permalink
Merge pull request #368 from ZuluSCSI/feature/X68000-quirk
Browse files Browse the repository at this point in the history
Add X68000 quirk for odd 0x00 CBD opcode
  • Loading branch information
aperezbios authored Jan 23, 2024
2 parents 6e0e50a + e65ecca commit c80c5bb
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/SCSI2SD/include/scsi2sd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/SCSI2SD/src/firmware/inquiry.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
27 changes: 22 additions & 5 deletions lib/SCSI2SD/src/firmware/scsi.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (C) 2014 Michael McMaster <[email protected]>
// Copyright (c) 2023 joshua stein <[email protected]>
// Copyright (c) 2023 Andrea Ottaviani <[email protected]>
//
// This file is part of SCSI2SD.
//
Expand Down Expand Up @@ -71,7 +72,7 @@ void enter_BusFree()

// Wait for the initiator to cease driving signals
// Bus settle delay + bus clear delay = 1200ns
// Just waiting the clear delay is sufficient.
// Just waiting the clear delay is sufficient.
s2s_delay_ns(800);

s2s_ledOff();
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -444,18 +462,18 @@ static void process_Command()
{
// The response is completely non-standard.
if (likely(allocLength > 12))
allocLength = 12;
allocLength = 12;
else if (unlikely(allocLength < 4))
allocLength = 4;
if (cfg->deviceType != S2S_CFG_SEQUENTIAL)
allocLength = 4;
allocLength = 4;
memset(scsiDev.data, 0, allocLength);
if (scsiDev.target->sense.code == NO_SENSE)
{
// Nothing to report.
}
else if (scsiDev.target->sense.code == UNIT_ATTENTION &&
cfg->deviceType == S2S_CFG_SEQUENTIAL)
cfg->deviceType == S2S_CFG_SEQUENTIAL)
{
scsiDev.data[0] = 0x10; // Tape exception
}
Expand Down Expand Up @@ -1389,4 +1407,3 @@ int scsiReconnect()
return reconnected;
}
*/

2 changes: 1 addition & 1 deletion src/ZuluSCSI_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion zuluscsi.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c80c5bb

Please sign in to comment.