Parcourir la source

Fix for VMS 5.5-2 for incorrect Inquiry command allocation lengths

Michael McMaster il y a 6 ans
Parent
commit
15c49b0793

+ 6 - 0
lib/SCSI2SD/CHANGELOG

@@ -1,3 +1,9 @@
+20191119		6.X.X
+	- Fix to prevent sending floppy geometry mode page when not configured as
+	a floppy (Thanks Landon Rodgers)
+	- Fix for VMS 5.5-2 Inquiry allocation lengths. Requires setting "vms" quirk
+	mode in the XML config (Thanks Landon Rodgers)
+
 20191030		6.2.8
 	- Fix incorrect results from the self-test function.
 

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

@@ -81,7 +81,8 @@ typedef enum
 	S2S_CFG_QUIRKS_NONE = 0,
 	S2S_CFG_QUIRKS_APPLE = 1,
 	S2S_CFG_QUIRKS_OMTI = 2,
-	S2S_CFG_QUIRKS_XEBEC = 4
+	S2S_CFG_QUIRKS_XEBEC = 4,
+	S2S_CFG_QUIRKS_VMS = 8
 } S2S_CFG_QUIRKS;
 
 typedef enum

+ 8 - 0
lib/SCSI2SD/src/firmware/inquiry.c

@@ -1,4 +1,5 @@
 //	Copyright (C) 2013 Michael McMaster <michael@codesrc.com>
+//	Copyright (C) 2019 Landon Rodgers  <g.landon.rodgers@gmail.com>
 //
 //	This file is part of SCSI2SD.
 //
@@ -154,6 +155,13 @@ void s2s_scsiInquiry()
 
 	if (scsiDev.phase == DATA_IN)
 	{
+		// VAX workaround
+		if (allocationLength == 255 &&
+			(scsiDev.target->cfg->quirks & S2S_CFG_QUIRKS_VMS))
+		{
+			allocationLength = 254;
+		}
+
 		// "real" hard drives send back exactly allocationLenth bytes, padded
 		// with zeroes. This only seems to happen for Inquiry responses, and not
 		// other commands that also supply an allocation length such as Mode Sense or

+ 9 - 0
lib/SCSI2SD/src/scsi2sd-util6/ConfigUtil.cc

@@ -168,6 +168,7 @@ ConfigUtil::toBytes(const S2S_TargetCfg& _config)
 	config.headsPerCylinder = fromLE16(config.headsPerCylinder);
 
 	const uint8_t* begin = reinterpret_cast<const uint8_t*>(&config);
+
 	return std::vector<uint8_t>(begin, begin + sizeof(config));
 }
 
@@ -229,6 +230,10 @@ ConfigUtil::toXML(const S2S_TargetCfg& config)
 	{
 		s << "xebec";
 	}
+	else if (config.quirks == S2S_CFG_QUIRKS_VMS)
+	{
+		s << "vms";
+	}
 
 	s <<
 			"</quirks>\n" <<
@@ -465,6 +470,10 @@ parseTarget(wxXmlNode* node)
 				{
 					result.quirks |= S2S_CFG_QUIRKS_XEBEC;
 				}
+				else if (quirk == "vms")
+				{
+					result.quirks |= S2S_CFG_QUIRKS_VMS;
+				}
 			}
 		}
 		else if (child->GetName() == "deviceType")