From 3997ec4d2d7d6f69b08d0c04ce8de0df03c52a45 Mon Sep 17 00:00:00 2001 From: salmonik Date: Fri, 31 Jul 2026 21:29:49 +0200 Subject: ahci: scan all ports; fat: mount first valid FAT32 disk 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 --- CONTEXT.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'CONTEXT.md') diff --git a/CONTEXT.md b/CONTEXT.md index 24a4b1e..aa9385b 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -170,7 +170,11 @@ Single Rust crate (`x86_64-unknown-uefi` target). Module breakdown: ✅ **AHCI + FAT32 (persistent disk)** — a SATA AHCI driver (polling DMA, no interrupts) plus a FAT32 filesystem, mounted as `/disk`; every shell command works on disk paths: `ls`/`cat`/`hexdump`/`echo >`/`>>`/ - `mkdir`/`touch`/`rm`/`edit`. Whole-FAT cache with write-back to both + `mkdir`/`touch`/`rm`/`edit`. The driver scans **all** implemented + ports (CAP.NP/PI) and starts every port with a device; `fat::init` + tries each disk in port order and mounts the first valid FAT32 + volume — so the kernel finds the disk no matter which AHCI port the + firmware/QEMU put it on (real hardware included). Whole-FAT cache with write-back to both FAT copies, checksum-validated LFN read/write, multi-cluster files, space-padded `.`/`..` dot entries (`..` → cluster 0 under the root), FSInfo free-count maintenance (fsck-clean after a session, verified -- cgit v1.2.3