-
Notifications
You must be signed in to change notification settings - Fork 0
piscsi64
PiSCSI64 is the newer SCSI backend for PiStorm64 on Amiga.
It presents host-backed storage to the Amiga as normal SCSI devices (hard disk, CD-ROM), with boot ROM support and direct pi-scsi64.device integration.
Status: active development target. Legacy PiSCSI is compatibility/maintenance only.
Validation status:
- Linux host path (local disk, block devices, remote server, and CD-ROM ISO) is validated.
- Windows/macOS remote client builds are present, but full runtime validation is still pending.
- Native dual-stack endpoint support is validated (IPv4 and true IPv6 addressing on Pi and remote endpoint).
PiSCSI64 is not just a rename of legacy PiSCSI.
-
PiSCSI(legacy) remains for compatibility with existing setups and known-good workflows. -
PiSCSI64is the newer path for ongoing development (typed media, better CD-ROM workflow, expanded SCSI-device model).
Both can exist in the tree/config while migration is in progress.
Example cfg lines:
setvar piscsi64
setvar piscsi64_1 /opt/Amiga/hdf/KernelPiStormBench.hdf
setvar piscsi64_3 cdrom:../AmigaOS39.iso
setvar piscsi64_5 disk:/dev/disk/by-id/usb-EXAMPLE,mode=ro
setvar piscsi64_6 remote:token@192.168.1.50:4964/workbench,mode=ro
setvar piscsi64_7 remote:token@[2001:db8::10]:4964/workbench,mode=roNotes:
- Unit
0is reserved for controller identity. - Use units
1..15for targets. - PiSCSI64 supports units/SCSI IDs
1..15. - Practical tool note: some HDToolBox versions only scan IDs
0..6even when the device itself supports wider IDs. -
cdrom:media is read-only by design. - If you map
/dev/...paths, the emulator process must have permission to open that block node.- A common failure is
errno=13(permission denied) when opening/dev/disk/by-id/.... - Check the emulator stdout/stderr for
[PISCSI64] Failed to open ... (errno=13). - This now also appears in
--logoutput as[ERROR] [PISCSI64] Failed to open .... - PiStorm64 ships optional udev rules in
etc/udev/99-pistorm.rulesforsd*/mmcblk*/nvme*block nodes (grouppistorm).
- A common failure is
-
/dev/...targets default to read-only unless explicitly overridden with,mode=rw. - When opened RW, PiSCSI64 emits a warning log line for visibility.
- Startup/map logs now include a per-unit summary line showing
media,mode(ro/rw),backend, andspec. - Current runtime model is one media spec per SCSI unit (1:1).
- No per-LUN media pool/playlist yet.
- For different simultaneous devices, use different units (
piscsi64_1..piscsi64_15).
- Local block media unplug is now detected and unit state is forced offline (
DRVTYPEno-present). - On backend I/O or probe errors (
ENODEV/ENOMEDIUM/disconnect classes), PiSCSI64 drops runtime media and keeps only the configured spec. - Amiga-side
TD_CHANGESTATE/TEST UNIT READYthen report the unit as removed until reinsert/remap.
PiSCSI64 now supports safe runtime media detach/reattach on the same unit.
- From Amiga side, explicit eject commands (
TD_EJECTand SCSISTART STOP UNITwith LoEj) trigger Pi-side media eject. - Reinsert on the same unit uses the unit's configured spec (same
setvar piscsi64_X ...path). - This is intended for "same unit, same configured source path" workflows.
Important:
- If you want a different backing path, remap that unit via config/update flow (or assign another unit).
- A per-unit "media pool" (multiple selectable sources on one SCSI ID) is not implemented yet.
To manage PiSCSI64 hard disks in HDToolBox, point HDToolBox at the correct device.
Typical method:
- Open Workbench and select the
HDToolBoxicon. - Open
Icon > Information. - In tool types, change the SCSI device from
scsi.devicetopi-scsi64.device. - Save and run HDToolBox again.
Important scan-range behavior:
- HDToolBox may only probe SCSI IDs
0..6depending on version/tooltype behavior. - This is an Amiga tooling limitation, not a PiSCSI64 unit limit.
- PiSCSI64 units above 6 (for example ID 14) are valid and can be used once prepared/mounted.
- If you need to prepare a high ID disk, initialize it on a lower ID first, then move it to the target high ID.
Boot priority warning:
- Avoid marking removable/test disks as bootable unless you intentionally want them in the boot chain.
- If a new disk has higher boot priority than your expected system disk, the Amiga may boot from the wrong target or appear to boot-loop.
- Keep data/test/USB media non-bootable, or set their boot priority lower than your primary system disk.
PiSCSI64 can expose large disks correctly (including remote exports), but classic Amiga tooling can still mis-handle geometry on large targets after "Install" in HDToolBox.
Observed behavior:
- First screen can show full size, then second screen can show a much smaller size (or even
0for some exact capacities). - This is typically a legacy CHS/display/math limitation in old tooling, not a PiSCSI64 block backend size bug.
Practical policy (recommended):
- For predictable setup, keep partitions at or below
16GB. - Over
16GB, split media into multiple partitions of max16GBeach. - For remote media, prefer exporting a specific partition path instead of a huge whole-disk target when using legacy setup tools.
- Field-tested behavior: partition-backed targets are reliable; very large whole-raw-disk targets can still trigger legacy geometry/tooling misreporting.
- Empirical legacy-tool threshold (auto geometry): around
48GBcan work cleanly without manual geometry edits; above this, classic tools often need manual intervention.
Example (remote, partition node):
setvar piscsi64_5 remote:token@192.168.1.50:4964/workbench_part3,mode=rwOn remote host, map that export to a partition path (example):
sudo piscsi64-remote \
--listen 0.0.0.0:4964 \
--export workbench_part3 \
--path /dev/disk/by-id/usb-EXAMPLE-0:0-part3 \
--token token \
--mode rwIf you need to sanity-check values manually:
total_blocks = bytes / sector_size
cylinders = floor(total_blocks / (heads * sectors_per_track))
chs_blocks = cylinders * heads * sectors_per_track
usable_bytes = chs_blocks * sector_size
LBA to CHS (for fixed geometry):
C = floor(LBA / (H * S))
tmp = LBA % (H * S)
Hn = floor(tmp / S)
Sn = (tmp % S) + 1
Notes:
-
BLOCKSfrom PiSCSI64 is LBA-based capacity and is the authoritative value. -
CHSis compatibility geometry for older tools and may not represent every last sector exactly. - Large-capacity values shown in first detection screens can be reduced on later "Install Drive" screens by legacy geometry fallback logic in old tools.
-
pfs3aioincludes experimental>104Gpartition support and may warn accordingly during format. - Large media can work (including tested 128GB scenarios), but for reliable day-to-day setup on classic tools, keep partition sizes sane (
<=16GBeach). - Historical context matters: classic Amiga workflows were designed in an era where
30MBwas considered a large hard drive on an Amiga 500 (circa 1989).
HDToolBox is for hard disks and will correctly report CD-ROM targets as unsupported.
Use a DOSDriver mount entry (CD0:) with CDFileSystem.
Example:
CD0:
FileSystem = L:CDFileSystem
Device = pi-scsi64.device
Unit = 3
Flags = 0
Surfaces = 1
SectorsPerTrack = 1
SectorSize = 2048
Mask = 0x7ffffffe
MaxTransfer = 0x100000
Reserved = 0
Interleave = 0
LowCyl = 0
HighCyl = 0
Buffers = 5
BufMemType = 0
StackSize = 1000
Priority = 10
GlobVec = -1
DosType = 0x43443031If you are using the existing Workbench CD0 icon:
- Go to
DEVS:DOSDrivers/CD0. - Select
CD0, then openIcon > Information. - In icon tool types, change
DEVICE=scsi.devicetoDEVICE=pi-scsi64.device. - Set
UNIT=3(or whichever unit your ISO is mapped to). - Reboot Amiga.
Then test in Shell:
mount CD0:
list CD0:Current prefixes:
-
disk:force hard-disk behavior -
cdrom:force CD-ROM behavior -
remote:use TCP remote backend export -
file:treat as file-backed media (default when no prefix is given)
Current mode option:
- append
,mode=roor,mode=rwto a device spec - examples:
disk:/dev/disk/by-id/usb-EXAMPLE,mode=rodisk:/dev/disk/by-id/usb-EXAMPLE,mode=rw./somefile.hdf,mode=ro
Current block-size option (disk/file backends):
- append
,blocksize=N(or,bs=N) - supported values:
512or4096 - examples:
disk:/dev/disk/by-id/usb-EXAMPLE,mode=rw,blocksize=4096file:/opt/Amiga/test.hdf,bs=4096
Notes:
-
cdrom:uses fixed 2048-byte blocks. -
remote:uses the server-advertised block size (--block-sizeonpiscsi64-remote), localblocksize=is ignored for remote specs.
Current convenience behavior:
-
.isopaths are treated as CD-ROM media automatically.
Format:
remote:token@host:port/export- token is required; port defaults to
4964if omitted. - IPv6 literals are supported:
- with explicit port:
remote:token@[2001:db8::10]:4964/export - default port:
remote:token@2001:db8::10/export
- with explicit port:
Examples:
setvar piscsi64_6 remote:token@192.168.1.50:4964/workbench,mode=rosetvar piscsi64_7 cdrom:remote:token@192.168.1.50:4964/os39isosetvar piscsi64_8 remote:token@[2001:db8::10]:4964/workbench,mode=rw
Notes:
- Remote defaults to
mode=rounless explicitly,mode=rw. -
cdrom:remains effectively read-only. - Remote FSHD extraction from backing media is not enabled yet; existing fs handler flow is unchanged.
- Remote liveness is probe-polled (PING) and offline is forced on disconnect-class failures.
- Remote transport is TLS-PSK encrypted end-to-end (headers + payload, current implementation using TLS 1.2 PSK ciphers).
- Token is used as PSK material and is not sent in clear in protocol payload.
- Fail-closed behavior:
- If endpoint is unreachable/not started, emulator continues and unit stays offline.
- Wrong port/export/token does not silently attach to media.
Validated result:
- Remote disk exported from another machine (
piscsi64-remote) over wired 1Gb Ethernet. - PiStorm64 mapped that export as a normal PiSCSI64 unit.
- Amiga initialized/partitioned/formatted the remote disk, copied system data, and booted from it.
- Example proven size: 8GB (
16777216blocks @512bytes).
Verified test example:
Server (remote host):
sudo ./out/piscsi64-remote \
--listen 172.16.0.2:4964 \
--export remotewb \
--path /dev/zvol/tank/piscsi64remotedisk \
--token 12345678 \
--mode rw
# IPv6 listen + export
sudo ./out/piscsi64-remote \
--listen [::]:4964 \
--export remotewb \
--path /dev/zvol/tank/piscsi64remotedisk \
--token 12345678 \
--mode rwPiStorm64 config:
setvar piscsi64
setvar piscsi64_6 remote:12345678@172.16.0.2:4964/remotewb,mode=rw
setvar piscsi64_7 remote:12345678@[2001:db8::10]:4964/remotewb,mode=rwTo keep remote SCSI exposure local, restrict TCP 4964 to trusted LAN interfaces/subnets.
Repository template (etc/nftables.conf) now includes:
-
iifname "end0"/"wlan0"+ RFC1918 source ranges for allow - Explicit drop for all other traffic to
tcp dport 4964 - IPv6 source filtering examples (
ip6 saddr) and port-set examples for multiple remote instances
Apply/reload:
sudo nft -f /etc/nftables.conf
sudo nft list rulesetSecurity notes:
- Replace RFC1918-wide ranges with your exact subnet where possible (example:
172.16.0.0/24). - Replace IPv6 examples with your exact prefix (example:
2a02:8012:bc57:1::/64). - Adjust interface names for your host (
end0,eth0,wlan0, etc.). - Firewall rules complement, but do not replace, local block-device permissions.
Multiple remote services:
- Each
piscsi64-remoteinstance must use a unique listen port. - Example:
- instance A:
--listen [::]:4964 --export workbench ... - instance B:
--listen [::]:4965 --export games ...
- instance A:
- Open those exact ports in nftables (prefer allow-list, then explicit drop).
Planned/roadmap prefixes:
floppy:zip:scanner:usb:
Goal: expose these as normal SCSI devices/disks to Amiga software, instead of custom one-off interfaces.
The implementation checklist is tracked in:
SCSI64TASKS.md
This is the source of truth for staged work (backend abstraction, block backend, config parsing, CD baseline, remote phase-1 and hardening tasks).
Implemented:
- Shared DOSType/FS-name normalization used by both
piscsi64and legacypiscsi. - Backend abstraction scaffolding in
piscsi64:- backend enum (
FILE,BLOCK,REMOTE) - per-unit backend metadata
- backend ops interface
- core I/O call sites routed through backend wrappers
- backend enum (
- Backend selection and mode control:
-
/dev/...=>BLOCKbackend (defaultro, optional,mode=rw) - non-
/dev=>FILEbackend (existing behavior preserved) - explicit mode override
,mode=ro|rwis supported
-
Pending (next steps):
- Remote multi-export management and per-export ACL/token policy.
- Optional per-unit media pool / source cycling (future feature).
- Documented HDToolBox scan-range limitation (
0..6) alongside PiSCSI64 wide-ID support (1..15).
Built from repo root:
make piscsi64-remotemake piscsi64-remote-servermake piscsi64-remote-client
Server example (Linux/Unix):
./out/piscsi64-remote \
--listen 0.0.0.0:4964 \
--export workbench \
--path /dev/disk/by-id/usb-EXAMPLE \
--token YOUR_SHARED_TOKEN \
--mode ro
./out/piscsi64-remote \
--listen [::]:4964 \
--export workbench \
--path /dev/disk/by-id/usb-EXAMPLE \
--token YOUR_SHARED_TOKEN \
--mode roClient probe example:
./out/piscsi64-remote-client 192.168.1.50:4964 workbench token 0 512
./out/piscsi64-remote-client [2001:db8::10]:4964 workbench token 0 512Probe client is optional and only for diagnostics; normal operation only needs the remote service plus remote:... mapping in Pi config.
Transport security note:
- Remote connection is TLS-PSK encrypted.
- Token is used for PSK authentication and not sent in protocol payload.
Windows utility path:
- Native Windows probe client source:
tools/piscsi64_remote/piscsi64_remote_client_win.c
- WSL2 cross-build:
sudo apt install mingw-w64make -f tools/piscsi64_remote/Makefile.windows- output:
tools/piscsi64_remote/out/piscsi64-remote-client.exe
- Build with MSVC:
cl /O2 /W3 tools\\piscsi64_remote\\piscsi64_remote_client_win.c ws2_32.lib libssl.lib libcrypto.lib
- Windows probe now uses the same TLS-PSK protocol as Linux/macOS client probe.
- Native Windows daemon/service support is planned as a follow-on phase.
macOS note:
- macOS client/server build support is present in tooling targets.
- Full macOS runtime validation is pending.
- Build:
make -j4 emulator
- Boot with known-good config and verify:
- normal boot path
- mapped hard disks visible in HDToolBox via
pi-scsi64.device - existing ISO/CD path still mounts as before
- Check logs for new backend-layer regressions before moving to next task in
SCSI64TASKS.md.