<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rs-dos/rsnix/src/ahci.rs, branch qemu</title>
<subtitle>Simple, kernel-only, 64bit OS, early stage.
</subtitle>
<id>https://git.2137697.xyz/rs-dos/atom?h=qemu</id>
<link rel='self' href='https://git.2137697.xyz/rs-dos/atom?h=qemu'/>
<link rel='alternate' type='text/html' href='https://git.2137697.xyz/rs-dos/'/>
<updated>2026-08-17T12:53:52Z</updated>
<entry>
<title>USB2/1.1 (EHCI/UHCI) drivers + real-hardware bring-up hardening</title>
<updated>2026-08-17T12:53:52Z</updated>
<author>
<name>salmonik</name>
<email>salmonik@tuta.io</email>
</author>
<published>2026-08-17T12:53:52Z</published>
<link rel='alternate' type='text/html' href='https://git.2137697.xyz/rs-dos/commit/?id=be868a43185826b02bf6d091019bb779678525bb'/>
<id>urn:sha1:be868a43185826b02bf6d091019bb779678525bb</id>
<content type='text'>
- Add polled EHCI (USB2) and UHCI (USB1.1) host-controller drivers with
  HID boot mouse support, wired into cursor polling and the 'usb' shell cmd
- Add USB Legacy ownership handoff (claim_usb_legacy) plus config_write_byte
- Harden boot: verify the PIT/timer ticks before shell entry, EOI stray
  interrupts in the LAPIC to stop interrupt storms, bound PS/2 controller
  waits, and INTx-disable AHCI (polled driver)
- Add boot stage markers, klog screen echo, and QR lock; scheduler
  mark_shell_running; NO_USB stopgap to keep BIOS USB-Legacy input alive
- alloc_pages_above for DMA buffers that must avoid low conventional memory
- Expand DEBUG_NOTES with EHCI/QEMU bring-up findings
</content>
</entry>
<entry>
<title>fix pi-lens warnings: unwraps, shell SC2046, dup code (fmtbuf/scripts/hexdump/cat/ahci/pci)</title>
<updated>2026-08-01T16:25:55Z</updated>
<author>
<name>salmonik</name>
<email>salmonik@tuta.io</email>
</author>
<published>2026-08-01T16:25:55Z</published>
<link rel='alternate' type='text/html' href='https://git.2137697.xyz/rs-dos/commit/?id=1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5'/>
<id>urn:sha1:1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5</id>
<content type='text'>
- memory.rs: self-test Layout::from_size_align no longer panics — the
  test fails cleanly on an invalid layout
- fat.rs: v() no longer unwraps the active-volume slot — invariant
  violation logs + halts instead of panicking mid-disk-io
- strbuf: shared FmtBuf replaces the duplicated PanicBuf/FmtBuf
  (main.rs + sched.rs)
- test-disk.sh: SC2046 — conditional --fresh arg no longer relies on
  word splitting
- scripts: boot.sh/boot-image.sh share lib-boot-args.sh (dup args loop)
- shell: cat/hexdump stdin pairs unified with Option&lt;&amp;str&gt; marker;
  hexdump format_row folded into format_partial
- ahci: read/write_sectors unified behind dma_sectors
- pci: config_read/write share config_addr
</content>
</entry>
<entry>
<title>rsnix: formatting</title>
<updated>2026-08-01T13:08:29Z</updated>
<author>
<name>salmonik</name>
<email>salmonik@tuta.io</email>
</author>
<published>2026-08-01T13:08:29Z</published>
<link rel='alternate' type='text/html' href='https://git.2137697.xyz/rs-dos/commit/?id=c04fc970e5d9b0c82ae2923af88ad870a74608af'/>
<id>urn:sha1:c04fc970e5d9b0c82ae2923af88ad870a74608af</id>
<content type='text'>
</content>
</entry>
<entry>
<title>rsnix: runtime device detection — rescan for hotplugged/removed disks</title>
<updated>2026-08-01T13:00:47Z</updated>
<author>
<name>salmonik</name>
<email>salmonik@tuta.io</email>
</author>
<published>2026-08-01T13:00:47Z</published>
<link rel='alternate' type='text/html' href='https://git.2137697.xyz/rs-dos/commit/?id=d562e9df2bc5e69bba7298a9439e2adca5c18faf'/>
<id>urn:sha1:d562e9df2bc5e69bba7298a9439e2adca5c18faf</id>
<content type='text'>
Phase 1: make the boot discovery pipeline re-runnable and diff it
against live hardware state.

- ahci: store ABAR/NP/port bitmap; poll_dirty() (cheap PxSSTS.DET check
  per port) and rescan() which starts newly-present ports and tombstones
  the slots of removed ones.  Slots never shift, so disk indices stay
  valid.  select() now rejects tombstoned slots.
- fat: Volume gets a mounted flag; rescan() unmounts volumes whose disk
  left and mounts every disk without a mounted volume (re-trying failed
  boot mounts).  UID dedup ignores tombstones so a re-plugged disk keeps
  its /disk/&lt;UID&gt; name.
- fs: init's mount loop factored into rescan_disks(), which lazily
  creates /disk, ensures a mount node per mounted volume and tombstones
  nodes of unmounted ones.
- shell: 'rescan' command + automatic deep rescan before each prompt
  when ahci::poll_dirty() sees a port-presence change.

Rescan events flow through serial_println so they land in klog too.
Removal (PxSSTS) is a real-hardware path: QEMU q35 rejects disk hotplug
on the ich9-ahci IDE buses, and PCIe device_del is a guest-cooperative
protocol this kernel does not implement.
</content>
</entry>
<entry>
<title>Clean up warnings, fix FAT32 multi-cluster dirs, prep for edition 2024</title>
<updated>2026-08-01T01:44:57Z</updated>
<author>
<name>salmonik</name>
<email>salmonik@tuta.io</email>
</author>
<published>2026-08-01T01:44:57Z</published>
<link rel='alternate' type='text/html' href='https://git.2137697.xyz/rs-dos/commit/?id=63d01e9d8eb6f3ccb6a96b7c577834276cf51add'/>
<id>urn:sha1:63d01e9d8eb6f3ccb6a96b7c577834276cf51add</id>
<content type='text'>
Warning cleanup (cargo check + clippy now 0 across the workspace):
- Migrate all 21 static_mut_refs sites to &amp;raw mut accessors (fat, gop,
  ps2, vt, ahci, interrupts, memory) so edition 2024 won't deny them
- panic = "abort" profiles: bare cargo check/build now works without
  nightly/-Zbuild-std
- Wire TICKS in the timer ISR (it was never incremented, so the vt scroll
  batching trigger was dead code)
- Clippy: efi_main becomes unsafe extern "efiapi" with a # Safety doc,
  KeyBuf::new uses inline-const array repeat (no interior-mutable const),
  editor main loop is a while-let, PIT control byte regrouped
- [workspace.lints.clippy] allows result_unit_err + needless_range_loop
  (deliberate kernel style); large_enum_variant allowed on LineInput
- Drop now-stale static_mut_refs allow from the rsdos bin

FAT32 correctness fixes (both pre-existing, exposed by the SFN fix):
- Unique 8.3 short names: to_8_3() never disambiguated collisions, so
  files sharing a long-name prefix got identical SFNs and fsck reported
  duplicate directory entries.  Add dir_short_names() + unique_short_name()
  (~N tails, Windows-style) and force LFN when the SFN changes.
- Multi-cluster directories: scan_dir/dir_short_names stopped at the first
  0x00 slot, hiding every entry written into a chained cluster (writes
  failed with 'cannot write', duplicate SFNs accumulated); add_dir_entry
  now packs the cluster (0xE5 deleted-markers) before extending so other
  FAT readers (mtools, Windows) see the continuation too.

Other: delete dead fields (Disk.fis, Volume.fat_count), drop timer_irq/
keyboard_irq/rendered, refresh_and_exit is a documented unsafe fn, CONTEXT
.md corrected (stable toolchain, IRQ input, 4-crate layout), .gitignore
excludes .pi-subagents artifacts.

Validated: cargo check/clippy/fmt clean, make test-disk PASS on fresh and
reused images (incl. two directory-chain extensions and ~10 SFN tails),
editor round-trip smoke test PASS.
</content>
</entry>
<entry>
<title>scripts: automate the data-disk workflow (mkdisk / sendkeys / test-disk)</title>
<updated>2026-07-31T23:56:12Z</updated>
<author>
<name>salmonik</name>
<email>salmonik@tuta.io</email>
</author>
<published>2026-07-31T23:56:12Z</published>
<link rel='alternate' type='text/html' href='https://git.2137697.xyz/rs-dos/commit/?id=4ea992c71dd0cdcffe0f74216e748256bd700a31'/>
<id>urn:sha1:4ea992c71dd0cdcffe0f74216e748256bd700a31</id>
<content type='text'>
- scripts/mkdisk.sh: create the FAT32 disk with mkfs.fat -C (the flag
  that actually creates the file — plain mkfs.fat fails on a missing
  path), accept M/G/K sizes, seed seed/ files via mtools; --fresh
  re-formats, --no-seed skips seeding
- scripts/sendkeys.py: type lines into the guest via the QEMU monitor
  (US layout).  Punctuation must use QEMU's named keys (minus, slash,
  dot, ...) — bare '-', '.', '/' are not valid sendkey names, and '-'
  is the modifier separator, so they were silently dropped before
- scripts/test-disk.sh: full automated round trip — build, deploy,
  ensure image, boot headless QEMU, drive the shell (ls /disk, mkdir,
  echo &gt;, cat, poweroff), then verify with fsck.fat (must be clean)
  and mtype (file content must have survived poweroff)
- Makefile: make disk / disk-fresh / inspect / test-disk; run, run-gui
  and debug now auto-create a missing DISK_IMG; fix the stale comment
  (mkfs.fat without -C)
- scripts/boot.sh: auto-create a missing DISK_IMG via mkdisk.sh
- seed/: motd.txt + lines.txt seeded onto fresh images
- Verified end to end: ./scripts/test-disk.sh --fresh passes
</content>
</entry>
<entry>
<title>ahci: skip ATAPI ports and fast-fail on device abort</title>
<updated>2026-07-31T23:42:25Z</updated>
<author>
<name>salmonik</name>
<email>salmonik@tuta.io</email>
</author>
<published>2026-07-31T23:42:25Z</published>
<link rel='alternate' type='text/html' href='https://git.2137697.xyz/rs-dos/commit/?id=3be5c6c8ee43a4c84e3a071831cbf87cc343f585'/>
<id>urn:sha1:3be5c6c8ee43a4c84e3a071831cbf87cc343f585</id>
<content type='text'>
A CD-ROM (or any ATAPI device) on a scanned port previously made the
driver spin the full 100M-iteration timeout on IDENTIFY, then log a
scary 'timed out' (QEMU leaves ATAPI aborts pending in PxCI instead of
completing the slot; tfd=0x441 = ABRT).

- skip a port up-front when firmware set PxCMD.ATAPI (bit 24)
- bail out of the completion poll as soon as PxTFD.ERR is set, clear
  the error bits and any wedged slot, and report the abort instead of
  timing out — the port scan stays fast with a CD attached
</content>
</entry>
<entry>
<title>ahci: scan all ports; fat: mount first valid FAT32 disk</title>
<updated>2026-07-31T19:29:49Z</updated>
<author>
<name>salmonik</name>
<email>salmonik@tuta.io</email>
</author>
<published>2026-07-31T19:29:49Z</published>
<link rel='alternate' type='text/html' href='https://git.2137697.xyz/rs-dos/commit/?id=3997ec4d2d7d6f69b08d0c04ce8de0df03c52a45'/>
<id>urn:sha1:3997ec4d2d7d6f69b08d0c04ce8de0df03c52a45</id>
<content type='text'>
The kernel previously started only AHCI port 0, so any launch where the
firmware/QEMU put something else on port 0 (e.g. the ESP from an implicit
-drive file=fat:rw:esp) left the real disk unnoticed: 'unsupported sector
size 0' and no mount.

- ahci.rs: enumerate CAP.NP/PI ports, start every port that links up
  (empty ports settle at DET=0 and are skipped quickly), keep up to 8
  disks, and expose disk_count()/select() for the filesystem
- fat.rs: try each disk in port order and mount the first valid FAT32
  volume; non-FAT disks are logged and skipped
- scripts/boot.sh: attach the data disk on ide.0 and the ESP on ide.1
  (DISK_IMG env var, default /tmp/disk.img), matching the Makefile
- Verified with the disk on port 0 (Makefile style), port 5 (old-style
  command line), and with the ESP on port 0; fsck.fat stays clean
</content>
</entry>
<entry>
<title>ahci: SATA driver + FAT32 persistent disk mounted at /disk</title>
<updated>2026-07-31T17:53:53Z</updated>
<author>
<name>salmonik</name>
<email>salmonik@tuta.io</email>
</author>
<published>2026-07-31T17:53:53Z</published>
<link rel='alternate' type='text/html' href='https://git.2137697.xyz/rs-dos/commit/?id=dc23d2f22cafeb6b97ba460789a834a6c586314d'/>
<id>urn:sha1:dc23d2f22cafeb6b97ba460789a834a6c586314d</id>
<content type='text'>
- ahci.rs: polling AHCI on PCI class 1/6/1, bus mastering + ABAR map,
  port 0 up, IDENTIFY + READ/WRITE DMA EXT through one 4KiB DMA buffer
- fat.rs: BPB parse, whole-FAT RAM cache with write-back to both copies,
  LFN read/write, dirs, multi-cluster files, FSInfo free-count sync,
  space-padded dot entries ('..' = cluster 0 under root), fsck-clean
- fs.rs: /disk mount node + 24-slot ephemeral node pool; ls/cat/hexdump/
  echo/mkdir/touch/rm/edit all work on disk paths unchanged
- QEMU: explicit bus assignment (disk=ide.0, ESP=ide.1); the implicit
  fat:rw:esp drive was stealing AHCI port 0
- Debugged against QEMU source: header DW0 is CFL in bits 4:0 / PRDTL in
  bits 31:16 (Linux libahci layout), FIS count at bytes 12-13, device at
  byte 7; QEMU rejects H2D FIS flags bits 6:4, so direction is the
  header W bit only
- Verified: full shell round-trip on /disk, reboot persistence (poweroff
  then mdir/mtype and a fresh boot), fsck.fat clean
</content>
</entry>
</feed>
