1. 18 May, 2020 1 commit
    • Robert Sprowson's avatar
      Revisit residue override logic · dd44bd45
      Robert Sprowson authored
      In SCSISoftUSB-0_27 all residue values were replaced with a locally computed one, however this seems to be tripped up by some brands of CD/DVD-ROM drive which stall, resulting in a differently wrong value being placed in the residue. Combat this by only replacing the residue with a locally computed one if it's obviously incorrect (as would be the case for reversed endianness and garbage upper byte).
      Thanks to Doug Webb, Chris Dale, and Chris Hall for helping test this on a variety of devices at their disposal; this restores some makes of drive that worked with SCSISoftUSB-0_26 and earlier, while also adding classes of quirky ones that now work.
      Version 0.28. Tagged as 'SCSISoftUSB-0_28'
  2. 18 Apr, 2019 1 commit
    • Robert Sprowson's avatar
      Fix for quirky devices which report bad residues · 70347aa3
      Robert Sprowson authored
      There's a class of devices which manage to get the dCSWDataResidue value wrong (for example, reversed endianness, or just garbage). This causes an error to be propagated up to SCSIDriver in and the initial CDB_CAPACITY to fail (only 8 bytes are expected). The error response is to fill the capacity with 0xFFFFFFFF's, which are then reported as a device of apparently 512TB in size.
      Take the stance that umass.c revision 1.146 in NetBSD takes, and simply ignore the device's residue; use the actual number of bytes transferred by the USB stack instead.
      umass.c: Compute dCSWDataResidue locally.
      global.h: Fix debug build, pointer type of states[] needs constifying.
      glue.c: Simplify the entry to glue_Tick; it is assumed to be entered with interrupts disabled, and all exits restore the interrupt state, so unconditionally disable - note that this is only needed for debugging when debuglib might enable interrupts for some output types, and thus allow reentrancy via RTSupport. Clean up a few comments in passing.
      Tested with a known bogus USB stick - now mounts successfully. Ref: Elesar ticket #78A-D76-74EC3.
      Version 0.27. Tagged as 'SCSISoftUSB-0_27'
  3. 13 Apr, 2019 5 commits
    • Robert Sprowson's avatar
      Update a few versions · 63867af3
      Robert Sprowson authored
      Contemporary with umass.c revision 1.123 from NetBSD. This is the latest version we can take without needing to make changes to USBDriver to reflect additions to the usb_attach_args struct (short of having a local copy which overrides it).
      Version 0.26. Tagged as 'SCSISoftUSB-0_26'
    • Robert Sprowson's avatar
      Update a few versions · 634df397
      Robert Sprowson authored
      Contemporary with umass.c revision 1.112 from NetBSD.
      Tagged as SCSISoftUSB-0_25-netbsd-1_112.
    • Robert Sprowson's avatar
      Update a few versions · d797c29e
      Robert Sprowson authored
      Contemporary with umass.c revision 1.102 from NetBSD.
      Tagged as SCSISoftUSB-0_25-netbsd-1_102.
    • Robert Sprowson's avatar
      Update a few versions · 9906b41c
      Robert Sprowson authored
      Fake implementation of usbd_do_request_flags(), slight collusion with USBDriver due to fudge introduced in 2004 - beware!
      Contemporary with umass.c revision 1.99 from NetBSD.
      Tagged as SCSISoftUSB-0_25-netbsd-1_99.
    • Robert Sprowson's avatar
      Sync with a known NetBSD copy · 4f630de0
      Robert Sprowson authored
      Wrap the RISC OS-isms with #ifdef __riscos, and some noisy tab/whitespace changes.
      Removed sc_sense from umass_softc (never set), was added in SCSISoftUSB-0_07, but appears to be left over from a future version - it'll be back later.
      Contemporary with umass.c revision 1.95 from NetBSD.
      Tagged as SCSISoftUSB-0_25-netbsd-1_95.
  4. 14 Oct, 2018 1 commit
    • Robert Sprowson's avatar
      Close the va_list · 9e055246
      Robert Sprowson authored
      Found by cppcheck static analysis.
      Tagged as SCSISoftUSB-0_25-1 since our va_end is an empty macro.
  5. 13 Jul, 2018 1 commit
  6. 01 Jul, 2018 1 commit
  7. 30 Jun, 2018 1 commit
    • John Ballance's avatar
      Bugfix to flush any bytes left in the pipe buffer once read is completed · f4c5a80e
      John Ballance authored
        In certain circumstances the Sense Status command can be sent more bytes
        than it requested. When this happened the system stalled until the device
        was unplugged. (The transfer was not completed because the system said
        there were still bytes to be read, though the command had read all it
        Tested on iMx6
      Version 0.23. Tagged as 'SCSISoftUSB-0_23'
  8. 29 May, 2018 1 commit
    • Robert Sprowson's avatar
      Update quirks table a bit · 11e2ca51
      Robert Sprowson authored
      It looks like the table came from NetBSD revision 1.39 (despite the claim it was 1.37, perhaps that line wasn't updated?).
      Go up to 1.45, which is the last revision before code changes to umass.c are needed (which ultimately obsolete many of the quirks).
      Add back the EASYDISK quirk, this was commented out in SCSISoftUSB-0_06 because the vendor was renamed in usbdevs 1.364, via a define to its new vendor name.
      Version 0.22. Tagged as 'SCSISoftUSB-0_22'
  9. 10 Mar, 2016 1 commit
    • Robert Sprowson's avatar
      Correct case sensitive compare never matching · 3bb23158
      Robert Sprowson authored
      In the module post init service call handler SCSIdriver -> SCSIDriver. While a caseless compare would also solve this, the only disc loading copy in RO5x0Hook loads the disc based SCSIDriver first anyway, so there's always a matched set there (as in ROM). Remove unused module post final service call handler too.
      module.c: adjust case, remove unused code
      modhdr.cmhg: remove unused service call table entry
      glue.c: adjust case (of debug/comments)
      Makefile: simplified given recent shared makefile improvements, notably the debug flags are now picked up from CDFLAGS/CMHGDFLAGS based on the target
      !MkDebug/!MkRam: pass in the target for which the obey file relates rather than 'all'
      Version 0.21. Tagged as 'SCSISoftUSB-0_21'
  10. 30 Jan, 2016 1 commit
    • ROOL's avatar
      Invert IRQ restore logic · da39d756
      ROOL authored
        If IRQs were not off, reenable them on exit. This is an academic fix as the CMHG veneers would reenable them when the CPSR is restored, but now self consistent with the other exits in this file.
        Spotted by Colin Granville. Not tested here.
      Version 0.20. Tagged as 'SCSISoftUSB-0_20'
  11. 12 Aug, 2014 1 commit
    • Jeffrey Lee's avatar
      Fixes and improvements to SCSI request padding · b51d874f
      Jeffrey Lee authored
        In order to keep block-based SCSI devices happy, the data transfer length must be a multiple of the block size. Unfortunately the RISC OS SCSI API considers the act of padding requests out to the correct size to be a driver problem rather than a client problem, and the USB SCSI spec doesn't provide a guaranteed way for a host to determine the correct transfer length for a command which has failed.
        To cope with this SCSISoftUSB contains some code to pad block read/write transfer lengths out to a multiple of the USB packet size. For high-speed USB devices using standard 512 byte sector sizes this works fine, but for low-speed devices or devices with less common block sizes it falls short.
        To rectify this SCSISoftUSB now listens out for any CAPACITY commands which are sent to the device and peeks at the result to determine the correct block size to use. Except for rare cases where the client takes a random guess at the block size this should allow SCSISoftUSB to get the correct block size itself without having to implement lots of extra logic to deal with devices being slow to initialise, etc.
        Additionally the padding code has been rewritten to ensure writes are padded with nulls (previously would read off the end of the supplied source data), and excess read bytes are discarded (previously would write off the end of the destination buffer)
        File changes: c/glue, h/global
        Tested on Raspberry Pi
        USB2 devices forced to run at USB1 speed now behave themselves during non-sector sized filecore ops
      Version 0.19. Tagged as 'SCSISoftUSB-0_19'
  12. 13 Jul, 2013 1 commit
  13. 26 Jun, 2013 1 commit
    • Robert Sprowson's avatar
      Revert interface/alternate muddle · cca950c1
      Robert Sprowson authored
      In glue.c revision 1.4 the interface and alternate were swapped round when generating the USB device special string. Presumably this was to work around DeviceFS not parsing them properly? DeviceFS does now, so this was tripping up any mass storage devices whose interface and alternate weren't the same.
      Version 0.17. Tagged as 'SCSISoftUSB-0_17'
  14. 03 Jun, 2012 1 commit
    • Jeffrey Lee's avatar
      Fix temporary RMA corruption while inside RTSupport routine · b935ae8d
      Jeffrey Lee authored
        Previously the RTSupport routine would execute in SYS mode, and use assembler veneers to make direct calls to the buffer manager.
        Despite being against the buffer manager spec (only IRQ or SVC should be used, according to PRM 5a), the buffer manager was coping with SYS mode calls fine. However the buffer manager would call DeviceFS, and DeviceFS would then call USBDriver, entering the module via one of CMHG's generic veneers.
        These veneers attempt to switch to SVC mode on entry, but they do so by only interacting with the bottom two bits of the PSR - so the CPU was remaining in SYS mode.
        Although this isn't a problem in and of itself, immediately after the mode change comes some code to set up the static relocation offsets at the SVC stack limit.
        This is done by aligning the stack pointer to a MB boundary. If we were in SVC mode this would be fine, but since we're still in SYS mode we're using a stack that was allocated by SCSISoftUSB and isn't aligned to a boundary at all; thus resulting in two words of RMA being swapped out with something completely different while the USBDriver code executes.
        With RTSupport in ROM this will most likely end up being the first two words of the heap - which is enough to stop OS_Module from manipulating the heap (the heap manager will see it as corrupt), but without causing any lasting damage.
        To solve this issue we now run the entire routine in SVC mode, using the MB-aligned SVC stack that RTSupport provides for us.
        File changes:
        c/global, c/cmodule, h/global - Get rid of the SYS mode stack since we no longer need it
        c/glue, h/glue - Extern RTSupportWrapper so it can be called from the assembler veneer. Tweak RT_Register parameters to pass in the relocation offsets (and no SYS stack)
        s/asm, h/asm - Added asm_RTSupportWrapper to get us into and out of SVC mode around the call to RTSupportWrapper. Also sets up our stack limit & relocation offsets within the SVC stack.
        Tested in BCM2835 ROM
      Version 0.16. Tagged as 'SCSISoftUSB-0_16'
  15. 27 Nov, 2011 1 commit
    • Jeffrey Lee's avatar
      Tidy source a bit · c6ff2236
      Jeffrey Lee authored
        Makefile, !MkDebug,fd7 - Rewritten to use makefile fragments
        c/svcprint, h/debug - Removed obsolete svcprint code
        c/module - Collapse MESSAGES option. Use STANDALONE #define instead of ROM_MODULE to decide whether resources are embedded or not.
        Tested in softload on Iyonix
      Version 0.15. Tagged as 'SCSISoftUSB-0_15'
  16. 24 Jul, 2011 1 commit
    • Jeffrey Lee's avatar
      Fix null pointer access · 3f82d388
      Jeffrey Lee authored
        c/glue - Not all operations make use of device->current_pipe, but glue_DoCommand was accessing the pipe pointer regardless of whether the maxpacket value was needed or not. This causes the code to fail if zero page is relocated.
        Tested on rev C2 BB.
      Version 0.14. Tagged as 'SCSISoftUSB-0_14'
  17. 23 Nov, 2010 1 commit
    • Jeffrey Lee's avatar
      Improve SCSISoftUSB debugging output · 0842fca8
      Jeffrey Lee authored
        c/glue, c/umass - tweaked a few debug output messages and converted some disabled printf() calls to DPRINTF() to make SCSISoftUSB's debugging output much more useful.
        Tested in ROM on rev C2 beagleboard.
        Changes shouldn't affect non-debug builds.
      Version 0.13. Tagged as 'SCSISoftUSB-0_13'
  18. 22 Apr, 2010 1 commit
    • Jeffrey Lee's avatar
      Make SCSISoftUSB's 'PopUpDelay' configurable, improve robustness of device registration · 368ea7b5
      Jeffrey Lee authored
        c/global, c/module, cmhg/header, h/global - The new command *SCSISoftUSB_PopUpDelay can now be used to control the popup delay value. Additionally, no delay is used if outside the desktop.
        Makefile, Resources/UK/Messages - Added resources file containing text for the new * command
        c/module, cmhg/header - Devices are now registered with SCSISwitch from a callback instead of from a ticker event. This ensures the registration won't fail due to insufficient RMA space (e.g. as is often the case for devices detected during OMAP ROM initialisation)
        Tested in ROM on rev C2 beagleboard, and in RAM on Iyonix.
        Messages file needs translating!
      Version 0.12. Tagged as 'SCSISoftUSB-0_12'
  19. 22 Oct, 2009 1 commit
    • Jeffrey Lee's avatar
      Update SCSISoftUSB to use RTSupport where possible, for much better USB performance · 5204687d
      Jeffrey Lee authored
        On initialisation SCSISoftUSB now checks if a suitable version of the RTSupport module is loaded (0.05 or above), and if so, will use RTSupport in preference to TickerV to schedule USB transfers. When combined with tweaked DeviceFS buffer thresholds and some extra code to listen out for buffer filling/emptying upcalls, this allows for significant performance improvements for USB 2.0 devices.
        If at any point RTSupport becomes unavailable or the RT_Register SWI fails (or if a suitable version of RTSupport is not present) the code will (potentially temporarily) fall back to using TickerV to ensure the filesystem remains functional.
        Tested on RISC OS 5.15 rev C2 beagleboard & RISC OS 5.12 Iyonix with & without RTSupport 0.05.
      Version 0.11. Tagged as 'SCSISoftUSB-0_11'
  20. 20 Sep, 2005 1 commit
  21. 10 Aug, 2005 1 commit
  22. 27 Jun, 2005 1 commit
  23. 24 Jun, 2005 1 commit
    • John Ballance's avatar
      Extend device coverage and better startup · 856c4169
      John Ballance authored
      	now checks any mass storage device for usability .. nolonger
      	restricts to types 8-5 and 8-6
      	delays scsi registration for 2 seconds beyond point where
      	module has finished initialising (overcomes issue seen with some
      	devices that fail an inquiry command if sent immediately after
      	device is enabled)
      	castle added IP. tested locally. now a release candidate to
      	be checked via the beta software site.
      Version 0.07. Tagged as 'SCSISoftUSB-0_07'
  24. 05 Mar, 2005 1 commit
    • John Ballance's avatar
      Numerous updates to improve working. · 655facbc
      John Ballance authored
      	Re-synced with NetBSD mass storage
      	Added part sector fill/ignore needed by SCSIFS
      Admin:  tested at castle.. to go to beta site.. Castle added IP
      Version 0.06. Tagged as 'SCSISoftUSB-0_06'
  25. 16 Jun, 2003 1 commit
  26. 13 Jun, 2003 1 commit
  27. 03 Jun, 2003 1 commit
    • Ben Avison's avatar
      Brought into line with latest version of SCSISoft spec. · 00ad2a9b
      Ben Avison authored
        * Returns separate error numbers for the different "cancel background
          operation" reasons
        * Reports that it supports scatter lists
        * Debugging output is LF-CR terminated, not CR-LF
        Tested briefly.
      Version 0.03. Tagged as 'SCSISoftUSB-0_03'
  28. 23 May, 2003 1 commit
    • Ben Avison's avatar
      Various changes to get it up to a releasable standard. · 61710f61
      Ben Avison authored
        * Unplugging of devices is now reliable.
        * Stall handling now works (requires USBDriver 0.17).
        * We now do max LUN checking, since devices don't seem to do it reliably
        * Unknown SCSI driver handler reason codes now return an error.
        * Scatter list handling improvements - eg individual transfers can now be
          bigger than the DeviceFS buffer size (accounting for the last.
        Tested with various mass storage devices.
      Version 0.02. Tagged as 'SCSISoftUSB-0_02'
  29. 14 May, 2003 3 commits