From c75fbc8e6e2e078851a6792499c5650dba2ca6b5 Mon Sep 17 00:00:00 2001 From: Michael McMaster Date: Sun, 12 Mar 2017 14:15:05 +1000 Subject: [PATCH] V4.7 release fixes --- CHANGELOG | 12 +- software/SCSI2SD/src/config.c | 27 +- software/SCSI2SD/src/inquiry.c | 525 +++++++++--------- software/SCSI2SD/src/scsi.c | 23 +- software/SCSI2SD/src/scsi.h | 13 +- software/SCSI2SD/src/scsiPhy.c | 3 + .../SCSI2SD/v3/SCSI2SD.cydsn/SCSI2SD.cyfit | Bin 271412 -> 271412 bytes .../SCSI2SD/v3/SCSI2SD.cydsn/SCSI2SD.cyprj | 14 + .../SCSI2SD/v4/SCSI2SD.cydsn/SCSI2SD.cyfit | Bin 274821 -> 274821 bytes .../SCSI2SD/v4/SCSI2SD.cydsn/SCSI2SD.cyprj | 14 + software/include/scsi2sd.h | 19 +- software/scsi2sd-util/ConfigUtil.cc | 41 +- software/scsi2sd-util/Makefile | 10 +- software/scsi2sd-util/TargetPanel.cc | 2 +- software/scsi2sd-util/scsi2sd-util.cc | 14 +- .../wxWidgets/src/osx/carbon/dataobj.cpp | 2 +- .../wxWidgets/src/osx/core/bitmap.cpp | 2 +- .../src/stc/scintilla/src/Editor.cxx | 5 +- 18 files changed, 437 insertions(+), 289 deletions(-) mode change 100644 => 100755 software/scsi2sd-util/ConfigUtil.cc mode change 100644 => 100755 software/scsi2sd-util/TargetPanel.cc mode change 100644 => 100755 software/scsi2sd-util/wxWidgets/src/osx/carbon/dataobj.cpp mode change 100644 => 100755 software/scsi2sd-util/wxWidgets/src/osx/core/bitmap.cpp diff --git a/CHANGELOG b/CHANGELOG index e773d33..00010ff 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,15 @@ -2016xxxx 4.x +20170312 4.7 + - Fix bug in SCSI Inquiry command for SCSI2 hosts + - Added OMTI host quirks mode + - Fix for booting from early Mac Plus ROMS + - Performance fix when SCSI2 mode is enabled. Some users may need + to disable SCSI2 mode if it was incorrectly enabled previously. - Added support for configurable mode pages + - Fix for exporting selectionDelay/startupDelay parameters to XML + via scsi2sd-util + - scsi2sd-util is now built with libudev1 on Linux, as all distros have + moved to this version. Users on older Linux distributions will need to + compile from source. 20160111 4.6 - Fixed bug when using sector size that isn't a multiple of 4 diff --git a/software/SCSI2SD/src/config.c b/software/SCSI2SD/src/config.c index eed072d..c5172e9 100755 --- a/software/SCSI2SD/src/config.c +++ b/software/SCSI2SD/src/config.c @@ -33,7 +33,7 @@ #include -static const uint16_t FIRMWARE_VERSION = 0x0460; +static const uint16_t FIRMWARE_VERSION = 0x0470; // 1 flash row static const uint8_t DEFAULT_CONFIG[256] = @@ -418,13 +418,24 @@ void configSave(int scsiId, uint16_t bytesPerSector) const TargetConfig* getConfigByIndex(int i) { - size_t row = SCSI_CONFIG_0_ROW + (i * SCSI_CONFIG_ROWS); - return (const TargetConfig*) - ( - CY_FLASH_BASE + - (CY_FLASH_SIZEOF_ARRAY * (size_t) SCSI_CONFIG_ARRAY) + - (CY_FLASH_SIZEOF_ROW * row) - ); + if (i <= 3) + { + size_t row = SCSI_CONFIG_0_ROW + (i * SCSI_CONFIG_ROWS); + return (const TargetConfig*) + ( + CY_FLASH_BASE + + (CY_FLASH_SIZEOF_ARRAY * (size_t) SCSI_CONFIG_ARRAY) + + (CY_FLASH_SIZEOF_ROW * row) + ); + } else { + size_t row = SCSI_CONFIG_4_ROW + ((i-4) * SCSI_CONFIG_ROWS); + return (const TargetConfig*) + ( + CY_FLASH_BASE + + (CY_FLASH_SIZEOF_ARRAY * (size_t) SCSI_CONFIG_ARRAY) + + (CY_FLASH_SIZEOF_ROW * row) + ); + } } const TargetConfig* getConfigById(int scsiId) diff --git a/software/SCSI2SD/src/inquiry.c b/software/SCSI2SD/src/inquiry.c index bc85904..9545475 100755 --- a/software/SCSI2SD/src/inquiry.c +++ b/software/SCSI2SD/src/inquiry.c @@ -1,258 +1,267 @@ -// Copyright (C) 2013 Michael McMaster -// -// This file is part of SCSI2SD. -// -// SCSI2SD is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// SCSI2SD is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with SCSI2SD. If not, see . -#pragma GCC push_options -#pragma GCC optimize("-flto") - -#include "device.h" -#include "scsi.h" -#include "config.h" -#include "inquiry.h" - -#include - -static uint8 StandardResponse[] = -{ -0x00, // "Direct-access device". AKA standard hard disk -0x00, // device type modifier -0x02, // Complies with ANSI SCSI-2. -0x01, // Response format is compatible with the old CCS format. -0x1f, // standard length. -0, 0, // Reserved -0x08 // Enable linked commands -}; -// Vendor set by config 'c','o','d','e','s','r','c',' ', -// prodId set by config'S','C','S','I','2','S','D',' ',' ',' ',' ',' ',' ',' ',' ',' ', -// Revision set by config'2','.','0','a' - -/* For reference, here's a dump from an Apple branded 500Mb drive from 1994. -$ sudo sg_inq -H /dev/sdd --len 255 -standard INQUIRY: - 00 00 00 02 01 31 00 00 18 51 55 41 4e 54 55 4d 20 ....1...QUANTUM - 10 4c 50 53 32 37 30 20 20 20 20 20 20 20 20 20 20 LPS270 - 20 30 39 30 30 00 00 00 d9 b0 27 34 01 04 b3 01 1b 0900.....'4..... - 30 07 00 a0 00 00 ff ...... - Vendor identification: QUANTUM - Product identification: LPS270 - Product revision level: 0900 -*/ - - -static const uint8 SupportedVitalPages[] = -{ -0x00, // "Direct-access device". AKA standard hard disk -0x00, // Page Code -0x00, // Reserved -0x04, // Page length -0x00, // Support "Supported vital product data pages" -0x80, // Support "Unit serial number page" -0x81, // Support "Implemented operating definition page" -0x82 // Support "ASCII Implemented operating definition page" -}; - -static const uint8 UnitSerialNumber[] = -{ -0x00, // "Direct-access device". AKA standard hard disk -0x80, // Page Code -0x00, // Reserved -0x10, // Page length -'c','o','d','e','s','r','c','-','1','2','3','4','5','6','7','8' -}; - -static const uint8 ImpOperatingDefinition[] = -{ -0x00, // "Direct-access device". AKA standard hard disk -0x81, // Page Code -0x00, // Reserved -0x03, // Page length -0x03, // Current: SCSI-2 operating definition -0x03, // Default: SCSI-2 operating definition -0x03 // Supported (list): SCSI-2 operating definition. -}; - -static const uint8 AscImpOperatingDefinition[] = -{ -0x00, // "Direct-access device". AKA standard hard disk -0x82, // Page Code -0x00, // Reserved -0x07, // Page length -0x06, // Ascii length -'S','C','S','I','-','2' -}; - -static void useCustomVPD(const TargetConfig* cfg, int pageCode) -{ - int cfgIdx = 0; - int found = 0; - while ((cfgIdx < sizeof(cfg->vpd) - 4) && - (cfg->vpd[cfgIdx + 3] != 0) - ) - { - int pageSize = cfg->vpd[cfgIdx + 3] + 4; - int dataPageCode = cfg->vpd[cfgIdx + 1]; - if (dataPageCode == pageCode) - { - memcpy(scsiDev.data, &(cfg->vpd[cfgIdx]), pageSize); - scsiDev.dataLen = pageSize; - scsiDev.phase = DATA_IN; - found = 1; - break; - } - cfgIdx += pageSize; - } - - if (!found) - { - // error. - scsiDev.status = CHECK_CONDITION; - scsiDev.target->sense.code = ILLEGAL_REQUEST; - scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB; - scsiDev.phase = STATUS; - } -} - -void scsiInquiry() -{ - uint8 evpd = scsiDev.cdb[1] & 1; // enable vital product data. - uint8 pageCode = scsiDev.cdb[2]; - uint32 allocationLength = scsiDev.cdb[4]; - - // SASI standard, X3T9.3_185_RevE states that 0 == 256 bytes - if (allocationLength == 0) allocationLength = 256; - - if (!evpd) - { - if (pageCode) - { - // error. - scsiDev.status = CHECK_CONDITION; - scsiDev.target->sense.code = ILLEGAL_REQUEST; - scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB; - scsiDev.phase = STATUS; - } - else - { - const TargetConfig* config = scsiDev.target->cfg; - memcpy(scsiDev.data, StandardResponse, sizeof(StandardResponse)); - scsiDev.data[1] = scsiDev.target->cfg->deviceTypeModifier; - memcpy(&scsiDev.data[8], config->vendor, sizeof(config->vendor)); - memcpy(&scsiDev.data[16], config->prodId, sizeof(config->prodId)); - memcpy(&scsiDev.data[32], config->revision, sizeof(config->revision)); - scsiDev.dataLen = sizeof(StandardResponse) + - sizeof(config->vendor) + - sizeof(config->prodId) + - sizeof(config->revision); - scsiDev.phase = DATA_IN; - } - } - else if (scsiDev.target->cfg->vpd[3] != 0) - { - useCustomVPD(scsiDev.target->cfg, pageCode); - } - else if (pageCode == 0x00) - { - memcpy(scsiDev.data, SupportedVitalPages, sizeof(SupportedVitalPages)); - scsiDev.dataLen = sizeof(SupportedVitalPages); - scsiDev.phase = DATA_IN; - } - else if (pageCode == 0x80) - { - memcpy(scsiDev.data, UnitSerialNumber, sizeof(UnitSerialNumber)); - scsiDev.dataLen = sizeof(UnitSerialNumber); - scsiDev.phase = DATA_IN; - } - else if (pageCode == 0x81) - { - memcpy( - scsiDev.data, - ImpOperatingDefinition, - sizeof(ImpOperatingDefinition)); - scsiDev.dataLen = sizeof(ImpOperatingDefinition); - scsiDev.phase = DATA_IN; - } - else if (pageCode == 0x82) - { - memcpy( - scsiDev.data, - AscImpOperatingDefinition, - sizeof(AscImpOperatingDefinition)); - scsiDev.dataLen = sizeof(AscImpOperatingDefinition); - scsiDev.phase = DATA_IN; - } - else - { - // error. - scsiDev.status = CHECK_CONDITION; - scsiDev.target->sense.code = ILLEGAL_REQUEST; - scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB; - scsiDev.phase = STATUS; - } - - - if (scsiDev.phase == DATA_IN) - { - // "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 - // Request Sense. - // (See below for exception to this rule when 0 allocation length) - if (scsiDev.dataLen < allocationLength) - { - memset( - &scsiDev.data[scsiDev.dataLen], - 0, - allocationLength - scsiDev.dataLen); - } - // Spec 8.2.5 requires us to simply truncate the response if it's - // too big. - scsiDev.dataLen = allocationLength; - - // Set the device type as needed. - switch (scsiDev.target->cfg->deviceType) - { - case CONFIG_OPTICAL: - scsiDev.data[0] = 0x05; // device type - scsiDev.data[1] |= 0x80; // Removable bit. - break; - - case CONFIG_SEQUENTIAL: - scsiDev.data[0] = 0x01; // device type - scsiDev.data[1] |= 0x80; // Removable bit. - break; - - case CONFIG_MO: - scsiDev.data[0] = 0x07; // device type - scsiDev.data[1] |= 0x80; // Removable bit. - break; - - case CONFIG_FLOPPY_14MB: - case CONFIG_REMOVEABLE: - scsiDev.data[1] |= 0x80; // Removable bit. - break; - default: - // Accept defaults for a fixed disk. - break; - } - } - - // Set the first byte to indicate LUN presence. - if (scsiDev.lun) // We only support lun 0 - { - scsiDev.data[0] = 0x7F; - } -} - -#pragma GCC pop_options +// Copyright (C) 2013 Michael McMaster +// +// This file is part of SCSI2SD. +// +// SCSI2SD is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// SCSI2SD is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with SCSI2SD. If not, see . +#pragma GCC push_options +#pragma GCC optimize("-flto") + +#include "device.h" +#include "scsi.h" +#include "config.h" +#include "inquiry.h" + +#include + +static uint8 StandardResponse[] = +{ +0x00, // "Direct-access device". AKA standard hard disk +0x00, // device type modifier +0x02, // Complies with ANSI SCSI-2. +0x01, // Response format is compatible with the old CCS format. +0x1f, // standard length. +0, 0, // Reserved +0x08 // Enable linked commands +}; +// Vendor set by config 'c','o','d','e','s','r','c',' ', +// prodId set by config'S','C','S','I','2','S','D',' ',' ',' ',' ',' ',' ',' ',' ',' ', +// Revision set by config'2','.','0','a' + +/* For reference, here's a dump from an Apple branded 500Mb drive from 1994. +$ sudo sg_inq -H /dev/sdd --len 255 +standard INQUIRY: + 00 00 00 02 01 31 00 00 18 51 55 41 4e 54 55 4d 20 ....1...QUANTUM + 10 4c 50 53 32 37 30 20 20 20 20 20 20 20 20 20 20 LPS270 + 20 30 39 30 30 00 00 00 d9 b0 27 34 01 04 b3 01 1b 0900.....'4..... + 30 07 00 a0 00 00 ff ...... + Vendor identification: QUANTUM + Product identification: LPS270 + Product revision level: 0900 +*/ + + +static const uint8 SupportedVitalPages[] = +{ +0x00, // "Direct-access device". AKA standard hard disk +0x00, // Page Code +0x00, // Reserved +0x04, // Page length +0x00, // Support "Supported vital product data pages" +0x80, // Support "Unit serial number page" +0x81, // Support "Implemented operating definition page" +0x82 // Support "ASCII Implemented operating definition page" +}; + +static const uint8 UnitSerialNumber[] = +{ +0x00, // "Direct-access device". AKA standard hard disk +0x80, // Page Code +0x00, // Reserved +0x10, // Page length +'c','o','d','e','s','r','c','-','1','2','3','4','5','6','7','8' +}; + +static const uint8 ImpOperatingDefinition[] = +{ +0x00, // "Direct-access device". AKA standard hard disk +0x81, // Page Code +0x00, // Reserved +0x03, // Page length +0x03, // Current: SCSI-2 operating definition +0x03, // Default: SCSI-2 operating definition +0x03 // Supported (list): SCSI-2 operating definition. +}; + +static const uint8 AscImpOperatingDefinition[] = +{ +0x00, // "Direct-access device". AKA standard hard disk +0x82, // Page Code +0x00, // Reserved +0x07, // Page length +0x06, // Ascii length +'S','C','S','I','-','2' +}; + +static void useCustomVPD(const TargetConfig* cfg, int pageCode) +{ + int cfgIdx = 0; + int found = 0; + while ((cfgIdx < sizeof(cfg->vpd) - 4) && + (cfg->vpd[cfgIdx + 3] != 0) + ) + { + int pageSize = cfg->vpd[cfgIdx + 3] + 4; + int dataPageCode = cfg->vpd[cfgIdx + 1]; + if (dataPageCode == pageCode) + { + memcpy(scsiDev.data, &(cfg->vpd[cfgIdx]), pageSize); + scsiDev.dataLen = pageSize; + scsiDev.phase = DATA_IN; + found = 1; + break; + } + cfgIdx += pageSize; + } + + if (!found) + { + // error. + scsiDev.status = CHECK_CONDITION; + scsiDev.target->sense.code = ILLEGAL_REQUEST; + scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB; + scsiDev.phase = STATUS; + } +} + +void scsiInquiry() +{ + uint8 evpd = scsiDev.cdb[1] & 1; // enable vital product data. + uint8 pageCode = scsiDev.cdb[2]; + uint32 allocationLength = scsiDev.cdb[4]; + + // SASI standard, X3T9.3_185_RevE states that 0 == 256 bytes + // BUT SCSI 2 standard says 0 == 0. + if (scsiDev.compatMode <= COMPAT_SCSI1) // excludes COMPAT_SCSI2_DISABLED + { + if (allocationLength == 0) allocationLength = 256; + } + + if (!evpd) + { + if (pageCode) + { + // error. + scsiDev.status = CHECK_CONDITION; + scsiDev.target->sense.code = ILLEGAL_REQUEST; + scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB; + scsiDev.phase = STATUS; + } + else + { + const TargetConfig* config = scsiDev.target->cfg; + memcpy(scsiDev.data, StandardResponse, sizeof(StandardResponse)); + scsiDev.data[1] = scsiDev.target->cfg->deviceTypeModifier; + + if (scsiDev.compatMode >= COMPAT_SCSI2) + { + scsiDev.data[3] = 2; // SCSI 2 response format. + } + memcpy(&scsiDev.data[8], config->vendor, sizeof(config->vendor)); + memcpy(&scsiDev.data[16], config->prodId, sizeof(config->prodId)); + memcpy(&scsiDev.data[32], config->revision, sizeof(config->revision)); + scsiDev.dataLen = sizeof(StandardResponse) + + sizeof(config->vendor) + + sizeof(config->prodId) + + sizeof(config->revision); + scsiDev.phase = DATA_IN; + } + } + else if (scsiDev.target->cfg->vpd[3] != 0) + { + useCustomVPD(scsiDev.target->cfg, pageCode); + } + else if (pageCode == 0x00) + { + memcpy(scsiDev.data, SupportedVitalPages, sizeof(SupportedVitalPages)); + scsiDev.dataLen = sizeof(SupportedVitalPages); + scsiDev.phase = DATA_IN; + } + else if (pageCode == 0x80) + { + memcpy(scsiDev.data, UnitSerialNumber, sizeof(UnitSerialNumber)); + scsiDev.dataLen = sizeof(UnitSerialNumber); + scsiDev.phase = DATA_IN; + } + else if (pageCode == 0x81) + { + memcpy( + scsiDev.data, + ImpOperatingDefinition, + sizeof(ImpOperatingDefinition)); + scsiDev.dataLen = sizeof(ImpOperatingDefinition); + scsiDev.phase = DATA_IN; + } + else if (pageCode == 0x82) + { + memcpy( + scsiDev.data, + AscImpOperatingDefinition, + sizeof(AscImpOperatingDefinition)); + scsiDev.dataLen = sizeof(AscImpOperatingDefinition); + scsiDev.phase = DATA_IN; + } + else + { + // error. + scsiDev.status = CHECK_CONDITION; + scsiDev.target->sense.code = ILLEGAL_REQUEST; + scsiDev.target->sense.asc = INVALID_FIELD_IN_CDB; + scsiDev.phase = STATUS; + } + + + if (scsiDev.phase == DATA_IN) + { + // "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 + // Request Sense. + // (See below for exception to this rule when 0 allocation length) + if (scsiDev.dataLen < allocationLength) + { + memset( + &scsiDev.data[scsiDev.dataLen], + 0, + allocationLength - scsiDev.dataLen); + } + // Spec 8.2.5 requires us to simply truncate the response if it's + // too big. + scsiDev.dataLen = allocationLength; + + // Set the device type as needed. + switch (scsiDev.target->cfg->deviceType) + { + case CONFIG_OPTICAL: + scsiDev.data[0] = 0x05; // device type + scsiDev.data[1] |= 0x80; // Removable bit. + break; + + case CONFIG_SEQUENTIAL: + scsiDev.data[0] = 0x01; // device type + scsiDev.data[1] |= 0x80; // Removable bit. + break; + + case CONFIG_MO: + scsiDev.data[0] = 0x07; // device type + scsiDev.data[1] |= 0x80; // Removable bit. + break; + + case CONFIG_FLOPPY_14MB: + case CONFIG_REMOVEABLE: + scsiDev.data[1] |= 0x80; // Removable bit. + break; + default: + // Accept defaults for a fixed disk. + break; + } + } + + // Set the first byte to indicate LUN presence. + if (scsiDev.lun) // We only support lun 0 + { + scsiDev.data[0] = 0x7F; + } +} + +#pragma GCC pop_options diff --git a/software/SCSI2SD/src/scsi.c b/software/SCSI2SD/src/scsi.c index 7aecf95..9ac58d6 100755 --- a/software/SCSI2SD/src/scsi.c +++ b/software/SCSI2SD/src/scsi.c @@ -33,6 +33,7 @@ #include "debug.h" #include "tape.h" #include "mo.h" +#include "vendor.h" #include @@ -138,6 +139,16 @@ void process_Status() uint8 message; uint8 control = scsiDev.cdb[scsiDev.cdbLen - 1]; + + if (scsiDev.target->cfg->quirks == CONFIG_QUIRKS_OMTI) + { + // OMTI non-standard LINK control + if (control & 0x01) + { + scsiDev.phase = COMMAND; return; + } + } + if ((scsiDev.status == GOOD) && (control & 0x01)) { // Linked command. @@ -155,6 +166,10 @@ void process_Status() { message = MSG_COMMAND_COMPLETE; } + +// TODO OMTI ENABLE VIA CONFIG +// scsiDev.status |= (scsiDev.target->targetId & 0x03) << 5 ; + scsiWriteByte(scsiDev.status); scsiDev.lastStatus = scsiDev.status; @@ -403,7 +418,7 @@ static void process_Command() { scsiReadBuffer(); } - else if (!scsiModeCommand()) + else if (!scsiModeCommand() && !scsiVendorCommand()) { scsiDev.target->sense.code = ILLEGAL_REQUEST; scsiDev.target->sense.asc = INVALID_COMMAND_OPERATION_CODE; @@ -566,7 +581,7 @@ static void process_SelectionPhase() // Only read these pins AFTER SEL and BSY - we don't want to catch them // during a transition period. - uint8 mask = scsiReadDBxPins(); + uint8 mask = (selLatchCfg && scsiDev.selFlag) ? scsiDev.selDBX : scsiReadDBxPins(); int maskBitCount = countBits(mask); int goodParity = (Lookup_OddParity[mask] == SCSI_ReadPin(SCSI_In_DBP)); int atnFlag = SCSI_ReadFilt(SCSI_Filt_ATN); @@ -617,9 +632,9 @@ static void process_SelectionPhase() } else if (!(scsiDev.boardCfg.flags & CONFIG_ENABLE_SCSI2)) { - scsiDev.compatMode = COMPAT_SCSI1; + scsiDev.compatMode = COMPAT_SCSI2_DISABLED; } - else if (scsiDev.compatMode == COMPAT_UNKNOWN) + else { scsiDev.compatMode = COMPAT_SCSI2; } diff --git a/software/SCSI2SD/src/scsi.h b/software/SCSI2SD/src/scsi.h index 844bbe3..63cc83f 100755 --- a/software/SCSI2SD/src/scsi.h +++ b/software/SCSI2SD/src/scsi.h @@ -61,6 +61,11 @@ typedef enum { COMPAT_UNKNOWN, COMPAT_SCSI1, + + // Messages are being used, yet SCSI 2 mode is disabled. + // This impacts interpretation of INQUIRY commands. + COMPAT_SCSI2_DISABLED, + COMPAT_SCSI2 } SCSI_COMPAT_MODE; @@ -106,12 +111,14 @@ typedef struct // Set to true (1) if the RST flag was set. volatile int resetFlag; - + // Set to true (1) if the SEL flag was set. volatile int selFlag; - + // Set to true (1) if a parity error was observed. - int parityError; + int parityError; + + volatile int selDBX; int phase; diff --git a/software/SCSI2SD/src/scsiPhy.c b/software/SCSI2SD/src/scsiPhy.c index f9959d5..d9699b3 100755 --- a/software/SCSI2SD/src/scsiPhy.c +++ b/software/SCSI2SD/src/scsiPhy.c @@ -80,6 +80,9 @@ CY_ISR(scsiSelectionISR) // selFlag is required for Philips P2000C which releases it after 600ns // without waiting for BSY. scsiDev.selFlag = 1; + + // Required for some early Mac Plus roms + scsiDev.selDBX = scsiReadDBxPins(); } uint8_t diff --git a/software/SCSI2SD/v3/SCSI2SD.cydsn/SCSI2SD.cyfit b/software/SCSI2SD/v3/SCSI2SD.cydsn/SCSI2SD.cyfit index 24f04512df98bed4c62d05484d02334573e2c3d3..be4308878bc0aad8c1b2e13e6feb0ff782007d45 100644 GIT binary patch delta 430 zcmdmTLSV}Y0lollW)=|!1_llW@uVEDjeMzPEFi|_^0N8jVAf=*zNZi&=KfQREV3ZU zixYZSSzJM^#AzRxA*|3@@1QLAd0(Nj4oiMOSvISVa6r_tY`zOoH~Hx{W3bRwrtKlynU@KHMYsPu$y~??VHTfec3@!%0IJ=-{XBC#GlVI1nK_ve z!fd?4?8C$o3Q}u~R+a*bHP~O%S1PbrfSok` zsR9ecanofKfqFrHo$jm1q7Pv;D6*JASi9h|uN7GgAz}(jKs&%XB9vH6!4983Q3+@Y q$dA(xDFN*Ov;Ki(L4KKTuFPTyVU;KY-2xWd3}S&iGX0Y>ixU912#mr2 delta 430 zcmdmTLSV}Y0lollW)=|!1_lm>FB{Z7Hu9yGv49wx%gg4AgISZM`kq3BnEOvLvM_H1 zN?x4M!^)x#VkJ)dzzku9&Uy!BxzGCwm33J11In^lb%X<=j%D**h`Py7w;6+lCd+I$ z0W+FIwzr3DX9QxV?IGKlmkF_G0PWcR?<8{}BZOIen%RMc#Rw$2{XBC#GlVI1nK_ve z!fd?4?8C%j22ybG8uJSeu*;|Km1og~u-?hDm_S%+3M>u~R+a*bHP~O%S1PbrfL${E zsR9ecanofKfqFrHo$jm1q7Pv;D6*JASi9h|uN7GgAz}(jKs&%XB9vH6A*_i?KvO`z onSMwKXa|_}4cH7u-Il03*?dMpOjgg0NTruCIA2c diff --git a/software/SCSI2SD/v3/SCSI2SD.cydsn/SCSI2SD.cyprj b/software/SCSI2SD/v3/SCSI2SD.cydsn/SCSI2SD.cyprj index 206f402..71f8a17 100755 --- a/software/SCSI2SD/v3/SCSI2SD.cydsn/SCSI2SD.cyprj +++ b/software/SCSI2SD/v3/SCSI2SD.cydsn/SCSI2SD.cyprj @@ -144,6 +144,13 @@ + + + + + + + @@ -308,6 +315,13 @@ + + + + + + + diff --git a/software/SCSI2SD/v4/SCSI2SD.cydsn/SCSI2SD.cyfit b/software/SCSI2SD/v4/SCSI2SD.cydsn/SCSI2SD.cyfit index c95451f70f281ac734965c1e5bfabc5f63299976..c2567cd77d6a32616c18111926716353d97dd092 100644 GIT binary patch delta 430 zcmZpDEYSK`fG@zCnMH(wfq{b|CoacpBj2ks77%0epR#OmFl%yl-&2TCNdGBDmLia( z(!?HCmYE>drfDCTA*^My-a%P2=KX@oPFn(FO<6UU1ES7!^IM3z$!gn;!9tT`x0`?& z%~Q9xPu1KK? z5XVi=)dT7U`E~j{Jr;ck>!Kcu8HB~H50kagXEB6`73u@+0P9$(&teK;J%XzfHh|gT iZvd19`DJ>C0gEMsb<_ap7O)u5G;6R&raK$5H~|2Yu$sF7 delta 430 zcmZpDEYSK`fG@zCnMH(wfq{deccZ$;M!r{NEFi|_KV{kCVAka9zNZkOkp5GQEVDq8 zN)vlnSq^|$o2GqWhOm~+dIx3AnD+}RJ8cP!HD%RY4v0F_&2J&ySVCAw4S;R|ivdlu276?>vmuKU0PO&xcK`qY diff --git a/software/SCSI2SD/v4/SCSI2SD.cydsn/SCSI2SD.cyprj b/software/SCSI2SD/v4/SCSI2SD.cydsn/SCSI2SD.cyprj index 2ba239f..5a2f270 100755 --- a/software/SCSI2SD/v4/SCSI2SD.cydsn/SCSI2SD.cyprj +++ b/software/SCSI2SD/v4/SCSI2SD.cydsn/SCSI2SD.cyprj @@ -144,6 +144,13 @@ + + + + + + + @@ -308,6 +315,13 @@ + + + + + + + diff --git a/software/include/scsi2sd.h b/software/include/scsi2sd.h index fdd43b8..7b17b52 100755 --- a/software/include/scsi2sd.h +++ b/software/include/scsi2sd.h @@ -46,8 +46,18 @@ extern "C" { |Row 188 | Config target 0 --------------------------------- |Row 187 | Board Config + | ... | Empty + |Row 172 | Empty --------------------------------- - |Row 186 | + |Row 171 | + | ... | + |Row 156 | Config target 6 + | ... | + |Row 140 | Config target 5 + | ... | + |Row 124 | Config target 4 + --------------------------------- + |Row 123 | | ... | |Row 0 | --------| | @@ -65,6 +75,7 @@ extern "C" { #include "stdint.h" +//#define MAX_SCSI_TARGETS 7 #define MAX_SCSI_TARGETS 4 #define SCSI_CONFIG_ARRAY 1 #define SCSI_CONFIG_ROWS 16 @@ -77,6 +88,9 @@ extern "C" { #define SCSI_CONFIG_1_ROW 204 #define SCSI_CONFIG_2_ROW 220 #define SCSI_CONFIG_3_ROW 236 +#define SCSI_CONFIG_4_ROW 124 +#define SCSI_CONFIG_5_ROW 140 +#define SCSI_CONFIG_6_ROW 156 typedef enum { @@ -110,7 +124,8 @@ typedef enum typedef enum { CONFIG_QUIRKS_NONE, - CONFIG_QUIRKS_APPLE + CONFIG_QUIRKS_APPLE, + CONFIG_QUIRKS_OMTI } CONFIG_QUIRKS; typedef struct __attribute__((packed)) diff --git a/software/scsi2sd-util/ConfigUtil.cc b/software/scsi2sd-util/ConfigUtil.cc old mode 100644 new mode 100755 index 3c3cdd0..6ac525b --- a/software/scsi2sd-util/ConfigUtil.cc +++ b/software/scsi2sd-util/ConfigUtil.cc @@ -248,9 +248,19 @@ ConfigUtil::toXML(const TargetConfig& config) " \n" << - " " << - (config.quirks & CONFIG_QUIRKS_APPLE ? "apple" : "") << + " "; + if (config.quirks == CONFIG_QUIRKS_APPLE) + { + s << "apple"; + } + else if (config.quirks == CONFIG_QUIRKS_OMTI) + { + s << "omti"; + } + + s << "\n" << "\n\n" << @@ -393,6 +403,19 @@ ConfigUtil::toXML(const BoardConfig& config) " " << (config.flags & CONFIG_MAP_LUNS_TO_IDS ? "true" : "false") << "\n" << + + " \n" << + " " << static_cast(config.selectionDelay) << "\n" << + + " \n" << + " " << static_cast(config.startupDelay) << "\n" << "\n"; return s.str(); @@ -471,6 +494,10 @@ parseTarget(wxXmlNode* node) { result.quirks |= CONFIG_QUIRKS_APPLE; } + else if (quirk == "omti") + { + result.quirks |= CONFIG_QUIRKS_OMTI; + } } } else if (child->GetName() == "deviceType") @@ -559,7 +586,15 @@ parseBoardConfig(wxXmlNode* node) wxXmlNode *child = node->GetChildren(); while (child) { - if (child->GetName() == "unitAttention") + if (child->GetName() == "selectionDelay") + { + result.selectionDelay = parseInt(child, 255); + } + else if (child->GetName() == "startupDelay") + { + result.startupDelay = parseInt(child, 255); + } + else if (child->GetName() == "unitAttention") { std::string s(child->GetNodeContent().mb_str()); if (s == "true") diff --git a/software/scsi2sd-util/Makefile b/software/scsi2sd-util/Makefile index cfcac9b..842441e 100755 --- a/software/scsi2sd-util/Makefile +++ b/software/scsi2sd-util/Makefile @@ -42,7 +42,8 @@ LDFLAGS += -L$(BUILD)/libzipper/.libs -lzipper $(LDFLAGS_ZLIB) $(LDFLAGS_HIDAPI) # wxWidgets 3.0.2 uses broken Webkit headers under OSX Yosemeti # liblzma not available on OSX 10.7 -WX_CONFIG=--disable-webkit --disable-webviewwebkit \ +# --disable-mediactrl for missing Quicktime.h on Mac OSX Sierra +WX_CONFIG=--disable-webkit --disable-webviewwebkit --disable-mediactrl \ --without-libtiff --without-libjbig --without-liblzma --without-opengl \ --enable-monolithic --enable-stl --disable-shared @@ -80,6 +81,13 @@ ifeq ($(TARGET),Darwin) CXX=clang++ -stdlib=libc++ -mmacosx-version-min=10.7 WX_CONFIG += --with-macosx-version-min=10.7 BUILD := $(PWD)/build/mac +all: $(BUILD)/scsi2sd-util.dmg + +$(BUILD)/scsi2sd-util.dmg: $(BUILD)/scsi2sd-util $(BUILD)/scsi2sd-monitor + mkdir -p $(dir $@)/dmg + cp $(BUILD)/scsi2sd-util $(BUILD)/scsi2sd-monitor $(dir $@)/dmg + chmod a+rx $(dir $@)/dmg/* + hdiutil create -srcfolder $(dir $@)/dmg $@ endif export CC CXX diff --git a/software/scsi2sd-util/TargetPanel.cc b/software/scsi2sd-util/TargetPanel.cc old mode 100644 new mode 100755 index a49deb7..d466643 --- a/software/scsi2sd-util/TargetPanel.cc +++ b/software/scsi2sd-util/TargetPanel.cc @@ -312,7 +312,7 @@ TargetPanel::evaluate() { case CONFIG_OPTICAL: mySectorSizeCtrl->ChangeValue("2048"); - mySectorSizeCtrl->Enable(false); + mySectorSizeCtrl->Enable(true); // Enable override break; case CONFIG_FLOPPY_14MB: mySectorSizeCtrl->ChangeValue("512"); diff --git a/software/scsi2sd-util/scsi2sd-util.cc b/software/scsi2sd-util/scsi2sd-util.cc index a80b462..333ad30 100644 --- a/software/scsi2sd-util/scsi2sd-util.cc +++ b/software/scsi2sd-util/scsi2sd-util.cc @@ -570,7 +570,7 @@ private: std::vector files(decomp.getEntries()); for (auto it(files.begin()); it != files.end(); it++) { - if (myBootloader->isCorrectFirmware((*it)->getPath())) + if (myBootloader && myBootloader->isCorrectFirmware((*it)->getPath())) { std::stringstream msg; msg << "Found firmware entry " << (*it)->getPath() << @@ -1007,11 +1007,13 @@ private: } } - flashRow = SCSI_CONFIG_0_ROW; for (size_t i = 0; i < myTargets.size(); - ++i, flashRow += SCSI_CONFIG_ROWS) + ++i) { + flashRow = (i <= 3) + ? SCSI_CONFIG_0_ROW + (i*SCSI_CONFIG_ROWS) + : SCSI_CONFIG_4_ROW + ((i-4)*SCSI_CONFIG_ROWS); std::vector raw(sizeof(TargetConfig)); for (size_t j = 0; j < SCSI_CONFIG_ROWS; ++j) @@ -1135,8 +1137,12 @@ private: flashRow = SCSI_CONFIG_0_ROW; for (size_t i = 0; i < myTargets.size(); - ++i, flashRow += SCSI_CONFIG_ROWS) + ++i) { + flashRow = (i <= 3) + ? SCSI_CONFIG_0_ROW + (i*SCSI_CONFIG_ROWS) + : SCSI_CONFIG_4_ROW + ((i-4)*SCSI_CONFIG_ROWS); + TargetConfig config(myTargets[i]->getConfig()); std::vector raw(ConfigUtil::toBytes(config)); diff --git a/software/scsi2sd-util/wxWidgets/src/osx/carbon/dataobj.cpp b/software/scsi2sd-util/wxWidgets/src/osx/carbon/dataobj.cpp old mode 100644 new mode 100755 index 758e3a7..6757e5e --- a/software/scsi2sd-util/wxWidgets/src/osx/carbon/dataobj.cpp +++ b/software/scsi2sd-util/wxWidgets/src/osx/carbon/dataobj.cpp @@ -30,7 +30,7 @@ #include "wx/osx/private.h" #if wxOSX_USE_COCOA_OR_CARBON - #include +// #include #endif // ---------------------------------------------------------------------------- diff --git a/software/scsi2sd-util/wxWidgets/src/osx/core/bitmap.cpp b/software/scsi2sd-util/wxWidgets/src/osx/core/bitmap.cpp old mode 100644 new mode 100755 index 3c61c17..4dd8e8e --- a/software/scsi2sd-util/wxWidgets/src/osx/core/bitmap.cpp +++ b/software/scsi2sd-util/wxWidgets/src/osx/core/bitmap.cpp @@ -36,7 +36,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) #endif #ifndef __WXOSX_IPHONE__ -#include +//#include #endif CGColorSpaceRef wxMacGetGenericRGBColorSpace(); diff --git a/software/scsi2sd-util/wxWidgets/src/stc/scintilla/src/Editor.cxx b/software/scsi2sd-util/wxWidgets/src/stc/scintilla/src/Editor.cxx index cd72953..2081df2 100644 --- a/software/scsi2sd-util/wxWidgets/src/stc/scintilla/src/Editor.cxx +++ b/software/scsi2sd-util/wxWidgets/src/stc/scintilla/src/Editor.cxx @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -5841,9 +5842,9 @@ void Editor::GoToLine(int lineNo) { } static bool Close(Point pt1, Point pt2) { - if (abs(pt1.x - pt2.x) > 3) + if (std::abs(pt1.x - pt2.x) > 3) return false; - if (abs(pt1.y - pt2.y) > 3) + if (std::abs(pt1.y - pt2.y) > 3) return false; return true; } -- 2.38.5