From dc23d2f22cafeb6b97ba460789a834a6c586314d Mon Sep 17 00:00:00 2001 From: salmonik Date: Fri, 31 Jul 2026 19:53:53 +0200 Subject: ahci: SATA driver + FAT32 persistent disk mounted at /disk - 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 --- rsdos/src/main.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'rsdos/src/main.rs') diff --git a/rsdos/src/main.rs b/rsdos/src/main.rs index c36660e..181d3e2 100644 --- a/rsdos/src/main.rs +++ b/rsdos/src/main.rs @@ -166,6 +166,16 @@ pub extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut SystemT let devices = rsnix::pci::probe(); rsnix::serial_println!("pci: {} device(s) on all buses", devices.len()); + // Disk: AHCI SATA driver, then mount a FAT32 volume if one is attached. + if !rsnix::ahci::init() { + rsnix::serial_println!("ahci: no disk attached"); + } + if rsnix::fat::init() { + rsnix::serial_println!("fat: volume mounted at /disk"); + } else { + rsnix::serial_println!("fat: no FAT32 volume"); + } + let (dirs, files) = rsnix::fs::init(); rsnix::serial_println!("fs: vfs ready — {} dirs, {} files", dirs, files); if rsnix::fs::self_test() { -- cgit v1.2.3