Add new "blind write" option to increase write command performance. This causes issue... V6.3.2
authorMichael McMaster <michael@codesrc.com>
Mon, 12 Oct 2020 10:30:30 +0000 (20:30 +1000)
committerMichael McMaster <michael@codesrc.com>
Mon, 12 Oct 2020 10:30:30 +0000 (20:30 +1000)
CHANGELOG
Makefile
include/scsi2sd.h
src/firmware/config.c
src/firmware/disk.c
src/scsi2sd-util6/BoardPanel.cc
src/scsi2sd-util6/BoardPanel.hh
src/scsi2sd-util6/ConfigUtil.cc
src/scsi2sd-util6/Makefile

index c99ebb8ea1d53ee39bb379ef9d65e25123dec11d..8ed88e9e82dbb7c59bf6973a9dc1ee36f3c552a2 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,9 @@
-2020xxxx               6.X.X
+20201012               6.3.2
        - Increase limit of READ/WRITE BUFFER command for improved compatibility
        SGI Iris hosts
+       - Add new config option to enable blind writes to improve SD card write
+       performance. This was previously enabled default but causes problems
+       with some SCSI hosts.
 
 20200419               6.3.1
        - Added checks to ensure the correct firmware version is loaded.
index 812b3ae1684b63f2697a0d91edf9a139289bffc0..021c52ad119fc2efd0797c72965978b09ac5049f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 ARMCC=arm-none-eabi-gcc
 OBJCOPY=arm-none-eabi-objcopy
 
-CPPFLAGS=-DSTM32F205xx -DUSE_HAL_DRIVER -Wall -Werror
+CPPFLAGS=-DSTM32F205xx -DUSE_HAL_DRIVER -Wall 
 CFLAGS=-mcpu=cortex-m3 -mthumb -mslow-flash-data \
        -std=gnu11 \
        -specs=nosys.specs \
index c5a4aaed1f23bedd956b07ef7da65350aad31553..1176a02cfb69c26af717a48ec1efa4432e2a20de 100755 (executable)
@@ -62,7 +62,8 @@ typedef enum
 
 typedef enum
 {
-       S2S_CFG_ENABLE_TERMINATOR = 1
+       S2S_CFG_ENABLE_TERMINATOR = 1,
+       S2S_CFG_ENABLE_BLIND_WRITES = 2,
 } S2S_CFG_FLAGS6;
 
 typedef enum
index 46ef3d7b309bff9728d02bbdcb1701268b797519..df19f9a18b0731a98c49fe2983f0a12c1520cef8 100755 (executable)
@@ -37,7 +37,7 @@
 \r
 #include <string.h>\r
 \r
-static const uint16_t FIRMWARE_VERSION = 0x0631;\r
+static const uint16_t FIRMWARE_VERSION = 0x0632;\r
 \r
 // Optional static config\r
 extern uint8_t* __fixed_config;\r
index f79842f0469cbb7a39b9e6620296729db8e91d68..f1fd8c869c1da091f0b182381137b2364925720f 100755 (executable)
@@ -551,7 +551,9 @@ int scsiDiskCommand()
 static uint32_t\r
 calcReadahead(uint32_t totalBytes, uint32_t sdSpeedKBs, uint32_t scsiSpeedKBs)\r
 {\r
-       if (scsiSpeedKBs == 0 || scsiDev.hostSpeedMeasured == 0)\r
+       if (!(scsiDev.boardCfg.flags6 & S2S_CFG_ENABLE_BLIND_WRITES) ||\r
+               (scsiSpeedKBs == 0) ||\r
+               (scsiDev.hostSpeedMeasured == 0))\r
        {\r
                return totalBytes;\r
        }\r
index e7a3b1901700a18390843865c5266c3ac012506d..2fc645bbbeb1eeba15a7085a36e3022e1946453d 100644 (file)
@@ -158,6 +158,16 @@ BoardPanel::BoardPanel(wxWindow* parent, const S2S_BoardCfg& initialConfig) :
        myMapLunsCtrl->SetToolTip(_("Treat LUNS as IDs instead. Supports multiple drives on XEBEC S1410 SASI Bridge"));
        fgs->Add(myMapLunsCtrl);
 
+
+       fgs->Add(new wxStaticText(this, wxID_ANY, wxT("")));
+       myBlindWriteCtrl =
+               new wxCheckBox(
+                       this,
+                       ID_blindWriteCtrl,
+                       _("Enable Blind Writes"));
+       myBlindWriteCtrl->SetToolTip(_("Enable writing to the SD card before all the SCSI data has been received."));
+       fgs->Add(myBlindWriteCtrl);
+
        wxBoxSizer* hbox = new wxBoxSizer(wxHORIZONTAL);
        hbox->Add(fgs, 1, wxALL | wxEXPAND, 15);
        this->SetSizer(hbox);
@@ -184,6 +194,7 @@ BoardPanel::getConfig() const
                (myMapLunsCtrl->IsChecked() ? S2S_CFG_MAP_LUNS_TO_IDS : 0);
 
        config.flags6 = (myTermCtrl->IsChecked() ? S2S_CFG_ENABLE_TERMINATOR : 0);
+       config.flags6 = (myBlindWriteCtrl->IsChecked() ? S2S_CFG_ENABLE_BLIND_WRITES : 0);
 
        config.startupDelay = CtrlGetValue<unsigned int>(myStartDelayCtrl).first;
        config.selectionDelay = CtrlGetValue<unsigned int>(mySelDelayCtrl).first;
@@ -200,6 +211,7 @@ BoardPanel::setConfig(const S2S_BoardCfg& config)
        myUnitAttCtrl->SetValue(config.flags & S2S_CFG_ENABLE_UNIT_ATTENTION);
        myScsi2Ctrl->SetValue(config.flags & S2S_CFG_ENABLE_SCSI2);
        myTermCtrl->SetValue(config.flags6 & S2S_CFG_ENABLE_TERMINATOR);
+       myBlindWriteCtrl->SetValue(config.flags6 & S2S_CFG_ENABLE_BLIND_WRITES);
        mySelLatchCtrl->SetValue(config.flags & S2S_CFG_ENABLE_SEL_LATCH);
        myMapLunsCtrl->SetValue(config.flags & S2S_CFG_MAP_LUNS_TO_IDS);
 
index 9d419b778dae699e34d02facf3a3ece7b33dcb3e..a21680cdead96099d470111febe677a870e6096b 100644 (file)
@@ -60,7 +60,8 @@ private:
                ID_mapLunsCtrl,
                ID_startDelayCtrl,
                ID_selDelayCtrl,
-               ID_scsiSpeedCtrl
+               ID_scsiSpeedCtrl,
+               ID_blindWriteCtrl,
        };
 
        wxWindow* myParent;
@@ -73,6 +74,7 @@ private:
        wxCheckBox* myTermCtrl;
        wxCheckBox* mySelLatchCtrl;
        wxCheckBox* myMapLunsCtrl;
+       wxCheckBox* myBlindWriteCtrl;
 
        wxIntegerValidator<uint8_t>* myDelayValidator;
        wxTextCtrl* myStartDelayCtrl;
index 3080c3327e0c776a6d56f3b5953797295250ad1d..26acaa79a8770c7f81143043e12e1b80fadcc540 100755 (executable)
@@ -384,6 +384,15 @@ ConfigUtil::toXML(const S2S_BoardCfg& config)
                "       ********************************************************* -->\n" <<
                "       <scsiSpeed>" << static_cast<int>(config.scsiSpeed) << "</scsiSpeed>\n" <<
 
+               "       <!-- ********************************************************\n" <<
+               "       Enable SD card blind writes, which starts writing to the SD\n"
+               "       card before all the SCSI data has been received. Can cause problems\n" <<
+               "       with some SCSI hosts\n" <<
+               "       ********************************************************* -->\n" <<
+               "       <blindWrites>" <<
+                       (config.flags6 & S2S_CFG_ENABLE_BLIND_WRITES ? "true" : "false") <<
+                       "</blindWrites>\n" <<
+
                "</S2S_BoardCfg>\n";
 
        return s.str();
@@ -603,6 +612,18 @@ parseBoardConfig(wxXmlNode* node)
                                result.flags6 = result.flags & ~S2S_CFG_ENABLE_TERMINATOR;
                        }
                }
+               else if (child->GetName() == "blindWrites")
+               {
+                       std::string s(child->GetNodeContent().mb_str());
+                       if (s == "true")
+                       {
+                               result.flags6 |= S2S_CFG_ENABLE_BLIND_WRITES;
+                       }
+                       else
+                       {
+                               result.flags6 = result.flags & ~S2S_CFG_ENABLE_BLIND_WRITES;
+                       }
+               }
                else if (child->GetName() == "selLatch")
                {
                        std::string s(child->GetNodeContent().mb_str());
index 2ec65dcacc526a00dd393dcc529f3fcdd671b12c..70d7abb73602a105de3865c290923542a0441cc2 100755 (executable)
@@ -106,6 +106,7 @@ ifeq ($(TARGET),Darwin)
        CC=clang -mmacosx-version-min=10.7
        CXX=clang++ -stdlib=libc++ -mmacosx-version-min=10.7
        WX_CONFIG += --with-macosx-version-min=10.7
+       CPPFLAGS_WXBUILD += -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1
        LIBUSB_CONFIG += --with-macosx-version-min=10.7 --disable-shared
        LDFLAGS_LIBUSB += -lobjc
        DFU-UTIL_CONFIG += --with-macosx-version-min=10.7 --disable-shared
@@ -189,6 +190,7 @@ $(BUILD)/libusb/buildstamp:
 endif
 
 ifneq ($(USE_SYSTEM_WX),Yes)
+$(OBJ): $(BUILD)/wx/buildstamp
 $(WXOBJ): $(BUILD)/wx/buildstamp
 $(EXEOBJ): $(BUILD)/wx/buildstamp
 ifneq ($(USE_SYSTEM_ZLIB),Yes)
@@ -199,7 +201,7 @@ endif
        mkdir -p $(dir $@)
        ( \
                cd $(dir $@) && \
-               $(CURDIR)/wxWidgets/configure $(WX_CONFIG) CPPFLAGS="$(CPPFLAGS_ZLIB)" LDFLAGS="$(LDFLAGS_ZLIB)" && \
+               $(CURDIR)/wxWidgets/configure $(WX_CONFIG) CPPFLAGS="$(CPPFLAGS_ZLIB) $(CPPFLAGS_WXBUILD)" LDFLAGS="$(LDFLAGS_ZLIB)" && \
                $(MAKE) \
        ) && \
        touch $@