116 Commits

Author SHA1 Message Date
Eric Helgeson
e5c420a19f wip2 2026-01-13 08:10:17 -06:00
Eric Helgeson
c3a70d1beb wip 2026-01-12 22:07:54 -06:00
Eric Helgeson
c6e1c5c6fa test read6 2026-01-12 21:50:38 -06:00
Eric Helgeson
947b357734 Fix read6 LBA. 2026-01-12 21:17:13 -06:00
Eric Helgeson
16b5be8724 WIPMacPlus 2026-01-12 16:44:54 -06:00
Daniel Markstedt
00743d1126 force man page to plain text output to 80 char width 2026-01-02 07:09:22 +09:00
Daniel Markstedt
363760f2cc Update version numbers for release 25.12.1 2025-12-30 15:39:07 +01:00
Daniel Markstedt
6b7d140351 Reintroduce clang-format rules and remove IDE specific configuration
This reverts a previous change where configurations for the Eclipse IDE specifically was introduced.

I think it's more important to have an IDE agnostic formatting framework, which clang-format provides

Example command for formatting all C++ source code, as run from within the cpp dir:

find . -iname '*.h' -o -iname '*.cpp' | xargs clang-format -i
2025-12-24 09:53:51 +01:00
Daniel Markstedt
7dc49d2311 Reduce overly detailed usage help text and refer to the man pages
This will reduce the recurring maintenance overhead of keeping the same information up to date in multiple places

Only the most common use cases are covered in the usage help text now
2025-12-24 01:03:47 +01:00
Daniel Markstedt
a99e1c51b9 Move the protobuf source into its own dir in the repo root
The protobuf source file is used by more than just the C++ code,
so let's move it into its own location for consistency and discoverability
2025-12-03 23:20:46 +01:00
Daniel Markstedt
db31ba291f have all objects depend on generated protobuf code (#1437)
Protect against compiler errors due to the protobuf header not existing yet when you compile multi threaded
2025-11-28 09:00:07 +01:00
Daniel Markstedt
f26fd6567a Override Eject function for Streamer device (#1538)
In order for the Eject command to properly release the image and reset the status,
we need to override the Eject function with the appropriate logic

The other removable disk drive devices inherit the Disk class,
and hence do not need this
2025-11-23 09:05:18 +01:00
Chris Hooper
25718e0887 Add support for drives larger than 2 TB (Closes: #1551)
Mode Sense (6) supports a 32-bit number for the maximum block count, where Mode Sense (10) supports a 64-bit number for the count. The Seagate SCSI Commands Reference Manual from 2016, has this to say about a "Short LBA mode parameter block descriptor" as returned by Mode Sense (6):

>  On a MODE SENSE command, if the number of logical blocks on the
>  medium exceeds the maximum value that is able to be specified in
>  the NUMBER OF LOGICAL BLOCKS field, the device server shall return
>  a value of FFFFFFFh.

Similarly, the Read Capacity (10) command should return FFFFFFFFh if the capacity of the drive exceeds 2^32 sectors, and that a driver should then know to use Read Capacity (16) if it supports that command.

There may be an unexpected side-effect if presenting a drive of more than 2^32 sectors to a legacy host that does not support devices that large. The Read Capacity commands specify the value returned as the last addressable sector on the device. This means that typically, an application which uses the value returned by that command is going to add 1 to it to get the actual number of blocks on a given device. If the program is not aware of Read Capacity (16), and is not using greater than 32-bit math, then it might report to the user that the total number of sectors on the drive as 0. I don't view this as a huge problem, however. In that case, the legacy driver wouldn't correctly support the capacity of the drive anyway, so providing that driver with a device that is 2 ^ 32 sectors or larger wouldn't make sense from the user perspective.
2025-11-18 21:03:26 +01:00
Daniel Markstedt
c642592551 Use generic SCSI TAPE product name and add more SCTP profiles 2025-11-10 19:51:57 +01:00
Daniel Markstedt
567dca9cc3 Add device type shorthand 't' for Tape, and change printer to 'p'
The scsictl command parser looks for single letter shorthands for each device type;
this adds 't' for SCTP and changes SCLP to 'p'

Now you can do '-t tape' and '-t printer' for an easy to remember command

Also moves the SCTP default product/vendor into the device factory,
updates the unit tests, and an overhauls the man pages
2025-11-10 19:51:57 +01:00
Daniel Markstedt
7f57c9e28d Introduce option to set the minimum execution time of SCSI commands (#741)
For the Status, DataIn, and DataOut phases, piscsi has a 50 microsecond
sleep implemented, which has proven a stabilizing factor for the bus
on most SCSI initiators

However, Akai S1100 and other samplers of a similar vintage need a longer
sleep time for reliable operation, so a -s option for piscsi has been
introduced to set the value to an artbitrary number at runtime
2025-11-09 09:37:33 +01:00
Daniel Markstedt
b7e7c4e529 Remove bitrotted X68000 host bridge device
The X68000 host bridge and associated host file system module
has not been functional for many years, as reported by multiple users

Removing the code will reduce complexity for users -
the SCBR device has caused some misunderstandings in the past -
while eliminating code that has been flagged as insecure by SonarQube
2025-11-09 08:45:56 +01:00
BogDan Vatra
18bb9548a7 Use same notation as scsi2pi 2025-11-07 18:20:31 +01:00
BogDan Vatra
a985fc83e4 Say hello to Streamer (tape) device support
Implements the mandatory and a few optional commands for tandberd see
https://bitsavers.org/pdf/tandbergData/TDC4100/6047-1_TDC-4100_SCSI-2_Interface_Functional_Specification_Aug1991.pdf
for more info.

Fixed #480
2025-11-07 07:43:21 +01:00
Daniel Markstedt
847c46e3c7 Update copyright year to 2025 in piscsi_util.cpp 2025-11-06 21:28:04 +01:00
Rick Altherr
b95c52dc85 Fix VCD timestamps (#1469)
* Fix VCD timestamps.

VCD simulation timestamps are integers.
eb71c31cf1 changed them to doubles which
causes the files to be unreadable.

* Fix VCD byte values

no spaces allowed between b and the bits.  Value will be left-extended
with zeros.
2024-06-20 19:27:06 -05:00
Daniel Markstedt
adfe0e4823 Update version for development 2024-05-01 16:10:39 +09:00
Daniel Markstedt
e540da06c4 Update version number for release 2024-04-29 18:32:28 +09:00
Daniel Markstedt
1919eb34bb Bump software copyright year to 2024 2024-04-23 08:00:58 +09:00
Daniel Markstedt
a6a8cadf21 Revert fixes for DEC vendor specific pages and CD-ROM block size changing (#1451)
* Revert "Don't ResizeCache on sector change if no filename is defined (#1438)"

This reverts commit dd9a3296d4.

* Revert "Add ModeSense page 0x25 (DEC special function control page) (#1412)"

This reverts commit 1121b8d9d6.

* Revert "DiskCache needs a size"

This reverts commit 7cc8df271c.

* Revert "Honor sector size change via ModeSelect6 in scsicd (#1406)"

This reverts commit b7f65d33e2.

* Revert "Multiple fixes for ModeSelect (#1405)"

This reverts commit ad5eae93e7.
2024-04-13 03:40:53 -07:00
Klaus Kämpf
dd9a3296d4 Don't ResizeCache on sector change if no filename is defined (#1438)
* Add tests for issue#1426

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>

* add test without medium

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>

* Don't resize DiskCache without a file

DiskCache computes its size from a file.
Skip ResizeCache Without file (i.e. 'empty' CD)

Fixes #1426

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
2024-02-27 11:20:22 +09:00
Uwe Seimet
24372ba939 Fix wrong warning about CD-ROM image file size 2024-02-27 11:18:01 +09:00
Uwe Seimet
4ae03e2ec7 Properly close file to be printed (#1428) 2024-02-03 07:51:44 +09:00
Daniel Markstedt
274b93fe27 Update unit tests 2024-01-27 07:22:19 +09:00
Daniel Markstedt
12d43f370d Update unit tests 2024-01-27 07:22:19 +09:00
Daniel Markstedt
040e5532a8 Recognize .cdr and .toast as CD-ROM image file endings 2024-01-27 07:22:19 +09:00
Klaus Kämpf
1121b8d9d6 Add ModeSense page 0x25 (DEC special function control page) (#1412)
* Add ModeSense page 0x25 (DECSpecialFunctionControlPage)

VAXServer 3100 (CPU KA41-E) console firmware issues ModeSense(6)
page 0x25 when probing for disks. A disk won't be recognized if
this returns an error.

The DEC SCSI specification[1], section 8.5 documents this page.

[1] https://manx-docs.org/collections/antonio/dec/dec-scsi.pdf

Fixes #1410

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
2024-01-18 16:55:38 -08:00
Klaus Kämpf
7cc8df271c DiskCache needs a size
otherwise its constructor assertion (block > 0) will fail.

Fixes #1418

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
2024-01-18 13:44:33 +09:00
Uwe Seimet
7a986c84aa Fix remote interface communication issue (broken pipe) (#1415) 2024-01-16 10:56:25 +09:00
Klaus Kämpf
b7f65d33e2 Honor sector size change via ModeSelect6 in scsicd (#1406)
* Make ModeSelect() non-const

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>

* Implement ModeSelect for scsicd

and honor sector size setting.

DEC's VMS can't handle 2k sector sizes and uses ModeSelect6 to set the
sector size to 512 bytes.

Fixes #1397

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>

* Test sector size setting via ModeSelect in SCSICD

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>

* Re-calculate total blocks when sector size changes

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>

* Reset CD data tracks after sector size change

The track calculation is based on sector size and must be reset after
change of sector size.

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>

* resize cache after change of sector size

The disk cache is based on sector size and must be resized when the
sector size changes.

Disk::ResizeCache needs a `raw` parameter, make this value accessible
from the current cache.

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>

* Make GetRawMode const

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>

---------

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
2024-01-10 06:36:24 +09:00
Klaus Kämpf
ad5eae93e7 Multiple fixes for ModeSelect (#1405)
* Allow 'empty' ModeSelect6

tl;dr

Treat a computed length of 0 as `has_valid_page_code`.

Details:

The SRM console (aka 'BIOS') of DEC Alpha sends an empty
ModeSelect6 with the following data:
~~~
ModeSelect6, CDB $151000000c00
~~~

That makes 12 byte(s) as follows
~~~
  0  1  2  3   4   5  6  7   8   9 10 11
 00 00 00 08  00  00 00 00  00  00 02 00
~~~

decoding it (accoring to [1], Section 8.3.3, Table 94) gives us

Mode Data Length 0
Medium Type      0
Device-specific  0
Block desc len   8

Density Code     0
Number of blks   0
Reserved         0
Block length     512

`scsi_command_util::ModeSelect` computes
~~~
offset = 4 + buf[3];
~~~

giving 12 and

~~~
length -= offset;
~~~

giving 0.

Thus it never enters the `while` loop and `has_valid_page_code` stays
`false`, raising an error.

[1] [Small Computer System Interface - 2 rev 10L.pdf](https://dn790004.ca.archive.org/0/items/SCSISpecificationDocumentsSCSIDocuments/Small%20Computer%20System%20Interface%20-%202%20rev%2010L.pdf)

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>

* Allow ModeSelect with page code 1

OpenVMS Alpha (the operating system, not the SRM BIOS) uses
ModeSelect6 with a page code of 1.

The semantics are unknown, just accepting it works for me.

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>

* Fix page length computation in ModeSelect

tl;dr

The 'skip to next ModeSelect page' computation was off-by-one, either not
taking the page code itself into account or missing the fact that the
page length is given as `n - 1`.

Fix:

Add 1 to the computed length.

Details:

OpenVMS Alpha sends a ModeSelect6 as follows
~~~
command:

ModeSelect6, CDB $151000001900

payload:

 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
00 00 00 08 00 00 00 00 00 00 02 00 01 0a 24 00 00 00 00 00 00 00 00 00 00
~~~

This translates to (accoring to [1], Section 8.3.3)

~~~
Mode Data Length 0
Medium Type      0
Device-specific  0
Block desc len   8
~~~

with the following offset / length computation _before_ the `while` loop
~~~
offset = 12
length = 13
~~~

The first payload section is
~~~
 4  5  6  7  8  9 10 11
00 00 00 00 00 00 02 00
~~~

translating to

~~~
Density Code     0
Number of blks   0
Reserved         0
Block length   0x200 512
~~~

Then follows a pagecode 1 as
~~~
12 13 14 15 16 17 18 19 20 21 22 23 24
01 0a 24 00 00 00 00 00 00 00 00 00 00
~~~

translating to
~~~~
Page code        1
Page length -1  10
Mode parameters 24 00 00 00 00 00 00 00 00 00 00
~~~

computing (inside the `while` loop, as `// Advance to the next page`)

~~~
size =  10 + 2 = 12
~~~

followed by new `offset` and `length` values

~~~
offset = 25
length = 1
~~~

So it stays in the `while` loop (and has a larger-than-buffer `offset`
value)

Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
2024-01-07 15:06:35 +09:00
Daniel Markstedt
28959aaf97 Revert "scsictl: Create files with binary/JSON or text format protobuf data (#1369)"
This reverts commit abc5c4b9ac.
2023-11-27 09:11:43 +09:00
Uwe Seimet
4d1a10cb6b Fix missing logging for a LUN when the LUN is explicitly specified (#1379)
* Fix missing logging for a LUN when the LUN is explicitly specified

* Do not suppress controller messages when LUN is specified

* Fix misleading logging for DaynaPort
2023-11-26 13:25:54 +09:00
Uwe Seimet
abc5c4b9ac scsictl: Create files with binary/JSON or text format protobuf data (#1369) 2023-11-20 07:40:53 +01:00
Uwe Seimet
a7c71e4fbb Replace system timer by C++ standard time for timeout of 3 s (#1361) 2023-11-16 12:40:10 +01:00
Uwe Seimet
bb602040e2 Improve BSD compile-time compatibility (#1342) 2023-11-16 12:37:50 +01:00
Uwe Seimet
70bcb78d24 Use a standard timer for the DaynaPort delay work-around (#1357)
* Do not use the proprietary system timer for the DaynaPort delay work-around
2023-11-15 07:51:21 +01:00
Uwe Seimet
ec9f83f9df Improve performance when reading sectors (#1344) 2023-11-15 07:44:46 +01:00
Uwe Seimet
28abbb5034 Temporary fix for compiler issue (#1359)
* Fix bookworm compiler issue

* fix to Docker for workaround

---------

Co-authored-by: Benjamin Krein <superbenk@gmail.com>
2023-11-15 07:36:07 +01:00
Uwe Seimet
98f9292690 NetBSD compatibility: Increase daynaport minimum packet size to 128 bytes (#1334) (#1335)
* NetBSD compatibility: Increase daynaport minimum packet size to 128 bytes
2023-11-14 16:13:14 +01:00
Uwe Seimet
baf89dcf86 Use standard C++ timer for long timeouts (#1327), remove unused code (#1328)
* Replace timer in WaitSignal()

' Remove unused code

* Remove unused file
2023-11-14 16:03:25 +01:00
Uwe Seimet
7fa9abe5a3 Remove fullspec/standard sub-folder (#1324)
* Remove fullspec/standard sub-folder
2023-11-14 15:51:36 +01:00
Uwe Seimet
71780449ff Move sector sizes lists from DeviceFactory to the respective devices (#1323) 2023-11-14 15:32:46 +01:00
Uwe Seimet
f6d00a0e96 Fix error count calculation (#1356) 2023-11-14 15:16:23 +01:00
Uwe Seimet
f7bc77d978 Add initial IDE setup (#1326) 2023-11-14 15:13:45 +01:00