Project

General

Profile

EWSD SCSI drive emulation » zulu-ewsd.patch

ZuluSCSI patch for EWSD support - jolly, 12/03/2023 10:17 AM

View differences:

lib/SCSI2SD/include/scsi2sd.h
84 84
	S2S_CFG_QUIRKS_OMTI = 2,
85 85
	S2S_CFG_QUIRKS_XEBEC = 4,
86 86
	S2S_CFG_QUIRKS_VMS = 8,
87
	S2S_CFG_QUIRKS_EMU = 9
87
	S2S_CFG_QUIRKS_EMU = 9,
88
	S2S_CFG_QUIRKS_EWSD = 10
88 89
} S2S_CFG_QUIRKS;
89 90

  
90 91
typedef enum
lib/SCSI2SD/src/firmware/scsi.c
139 139
{
140 140
	scsiEnterPhase(STATUS);
141 141

  
142
	if (scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_EWSD)
143
	{
144
		s2s_delay_ms(1);
145
	}
146

  
142 147
	uint8_t message;
143 148

  
144 149
	uint8_t control = scsiDev.cdb[scsiDev.cdbLen - 1];
......
517 522
			scsiDev.data[7] = 10; // additional length
518 523
			scsiDev.data[12] = scsiDev.target->sense.asc >> 8;
519 524
			scsiDev.data[13] = scsiDev.target->sense.asc;
525
			if ((scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_EWSD))
526
			{
527
				/* EWSD seems not to want something behind additional length. (8 + 0x0e = 22) */
528
				allocLength=22;
529
				scsiDev.data[7] = 0x0e;
530
			}
520 531
		}
521 532

  
522 533
		// Silently truncate results. SCSI-2 spec 8.2.14.
......
531 542
	// on receiving the unit attention response on boot, thus
532 543
	// triggering another unit attention condition.
533 544
	else if (scsiDev.target->unitAttention &&
534
		(scsiDev.boardCfg.flags & S2S_CFG_ENABLE_UNIT_ATTENTION))
545
		scsiDev.target->unitAttention_stop == 0 &&
546
		((scsiDev.boardCfg.flags & S2S_CFG_ENABLE_UNIT_ATTENTION) ||
547
		(scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_EWSD)))
535 548
	{
549
		/* EWSD requires unitAttention to be sent only once. */
550
		if (scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_EWSD)
551
		{
552
			scsiDev.target->unitAttention_stop = 1;
553
		}
536 554
		scsiDev.target->sense.code = UNIT_ATTENTION;
537 555
		scsiDev.target->sense.asc = scsiDev.target->unitAttention;
538 556

  
......
1257 1275
		scsiDev.targets[i].reserverId = -1;
1258 1276
		if (firstInit)
1259 1277
		{
1260
			scsiDev.targets[i].unitAttention = POWER_ON_RESET;
1278
			if ((cfg->deviceType == S2S_CFG_MO) && (scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_EWSD))
1279
			{
1280
				scsiDev.targets[i].unitAttention = POWER_ON_RESET_OR_BUS_DEVICE_RESET_OCCURRED;
1281
			} else
1282
			{
1283
				scsiDev.targets[i].unitAttention = POWER_ON_RESET;
1284
			}
1261 1285
		}
1262 1286
		else
1263 1287
		{
lib/SCSI2SD/src/firmware/scsi.h
102 102
	ScsiSense sense;
103 103

  
104 104
	uint16_t unitAttention; // Set to the sense qualifier key to be returned.
105
	uint8_t unitAttention_stop; // Indicates if unit attention has to be stopped.
105 106

  
106 107
	// Only let the reserved initiator talk to us.
107 108
	// A 3rd party may be sending the RESERVE/RELEASE commands
src/ZuluSCSI_disk.cpp
1200 1200
    {
1201 1201
        uint32_t highestBlock = capacity - 1;
1202 1202

  
1203
	if (pmi && scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_EWSD)
1204
	{
1205
		highestBlock = 0x00001053;
1206
	}
1203 1207
        scsiDev.data[0] = highestBlock >> 24;
1204 1208
        scsiDev.data[1] = highestBlock >> 16;
1205 1209
        scsiDev.data[2] = highestBlock >> 8;
zuluscsi.ini
17 17
# The PhyMode parameter has no effect on ZuluSCSI RP2040-based platforms, as there is only one PHY mode.
18 18

  
19 19
# Settings that can be needed for compatibility with some hosts
20
#Quirks = 0   # 0: Standard, 1: Apple, 2: OMTI, 4: Xebec, 8: VMS
20
#Quirks = 0   # 0: Standard, 1: Apple, 2: OMTI, 4: Xebec, 8: VMS, 9: EMU, 10: EWSD
21 21
#EnableUnitAttention = 0 # Post UNIT_ATTENTION status on power-on or SD card hotplug
22 22
#EnableSCSI2 = 1 # Enable faster speeds of SCSI2
23 23
#EnableSelLatch = 0 # For Philips P2000C and other devices that release SEL signal before BSY
(2-2/2)
Add picture from clipboard (Maximum size: 48.8 MB)