From 951272ac3935cc7a411f61257433923f3b762008 Mon Sep 17 00:00:00 2001 From: James Braid Date: Sun, 22 Nov 2026 16:18:44 -0700 Subject: [PATCH] mgras: answer byte and halfword reads of the GIO ID word OpenBSD 6.9's sgi kernel found no console on a High IMPACT and ran silent: the ARCS loader printed "Found SGI-IP28, setting up." and the screen never changed (#833). The guest was not hung. It sat in the idle loop, and the kernel's Impact console softc was still zero. OpenBSD's gio_id() reads the slot's ID word, then a halfword at +2 and a byte at +3, and trusts the word as a 32-bit ID only if those equal its low bytes. The board answered the word (0x00050190) but returned 0 for the narrow reads, so the probe went on to the REX3 and GR2 tests and rejected the board. An MGRAS trace of the boot shows rd gio_id = 0x00050190, rd [2] = 0, rd [3] = 0, then no more board access. IRIX reads the ID as a word, which is why nothing else noticed. Return the ID's bytes at their big-endian lanes for byte and halfword reads in the first word. Whether a real board answers these with the lanes or a bus error is unchecked. The driver accepts either, and zero is the one answer it cannot. Tested: the same install69.iso on indigo2_ip28 (256 MB, highimpact) now prints "impact0 at gio0 addr 0x1f000000: High Impact/TRAM option card" and reaches the installer prompt. The GR2 board still does. IRIX 6.5.22 boots to its serial login on a highimpact IP28 and loads its HQ3 microcode. Not checked: IRIX graphics on a High IMPACT, and the Solid and Maximum IMPACT boards, which share the same ID. Fixes: 0b1ea38cde9d ("mgras: an IMPACT board model in place of the ID stub") --- clanker/INDEX.md | 1 + .../impact-id-word-answers-narrow-reads.md | 37 +++++++++++++++++++ src/dev/mgras/mgras_tests.rs | 14 +++++++ src/dev/mgras/mod.rs | 13 ++++++- 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 clanker/devices/impact-id-word-answers-narrow-reads.md diff --git a/clanker/INDEX.md b/clanker/INDEX.md index 9d756ffc0..0d8778842 100644 --- a/clanker/INDEX.md +++ b/clanker/INDEX.md @@ -160,6 +160,7 @@ Non-graphics devices: MC/MEMCFG and RAM banks, HPC3, VDMA, EEPROMs and NVRAM, PS | [ip30-linux-7.3-guest.md](devices/ip30-linux-7.3-guest.md) | howto | Octane: mainline Linux 7.3 config, the PROM/Linux PCI window mismatch and the root-bus scan past device 7 (kernel patch), TFTP or volume-header boot, no power-off | | [ip30-device-timing-on-hptimer.md](devices/ip30-device-timing-on-hptimer.md) | design | Octane: IOC3, RAD1 and ISP1040 pace themselves on `hptimer` one-shots, with threads only where something blocks (the ISP1040 ring, serial receive, NVRAM writer) | | [ip30-openbsd-needs-64gb-window-and-slot-4-empty.md](devices/ip30-openbsd-needs-64gb-window-and-slot-4-empty.md) | rule | Octane: OpenBSD 6.9 reaches PCI through the Bridges' 64 GB windows (IOC3 at 0xF0_4050_0000) and takes the SuperIO interrupt from the first empty Bridge slot, so virtio goes in slots 6 and 7 (`bridge_slot`); what it attaches | +| [impact-id-word-answers-narrow-reads.md](devices/impact-id-word-answers-narrow-reads.md) | rule | High IMPACT: the GIO ID word must also answer 8- and 16-bit reads at its byte lanes; OpenBSD 6.9's `gio_id()` otherwise rejects the board, never attaches the Impact console, and the kernel runs silent in `sched_idle` (#833) | | [ip30-ps2-keyboard-runs-set-3.md](devices/ip30-ps2-keyboard-runs-set-3.md) | rule | Octane: PROM 4.17 and IRIX's `ioc3_pckm` put the PS/2 keyboard in scan code set 3 (Linux/OpenBSD use 2); K_RD slot order, CLAMP_THREE, role by F2 answer; how the PROM's keyboard sequence was traced | | [ip30-promdrive.py](devices/ip30-promdrive.py) | howto | Drives the Octane PROM on its TCP serial console: waits for the maintenance menu, enters the command monitor, runs commands, echoes everything | | [aic7880-emulation-vs-spec.md](devices/aic7880-emulation-vs-spec.md) | open | AIC-7880: where the O2 SCSI model departs from `docs/dev/aic7880.md` (HLE above the sequencer, reset values, wide strap, residuals, interrupt gating, config space) | diff --git a/clanker/devices/impact-id-word-answers-narrow-reads.md b/clanker/devices/impact-id-word-answers-narrow-reads.md new file mode 100644 index 000000000..786294212 --- /dev/null +++ b/clanker/devices/impact-id-word-answers-narrow-reads.md @@ -0,0 +1,37 @@ +# OpenBSD 6.9 on a High IMPACT: the GIO ID word must answer byte and halfword reads + +Status: fixed 2026-11-22 (issue #833: OpenBSD 6.9 stops after "Found SGI-IP28, +setting up." on `highimpact`; the same ISO boots on `xz`). + +Symptom: the ARCS loader prints its banner and the kernel prints nothing, +forever. The guest is not hung: PC samples sit in `sched_idle` (the idle loop) +and the kernel is waiting for the installer's console it never got. Kernel +memory shows `giofb_consid` = 0 and `impact_cons` all zero: the Impact +console was never attached, so no kernel output reaches the screen, which +keeps showing the PROM's text window. + +Cause: OpenBSD's `gio_id()` (sys/arch/sgi/gio/gio.c) reads the word at the +slot base, then a halfword at +2 and a byte at +3, and only trusts the word as +a 32-bit ID when they match its low bytes. The board answered the word +(0x00050190) but read 0 at +2 and +3 (a register-file lookup of an unmapped +offset), so the probe fell through to the "is it a REX3 or GR2" tests and +returned nothing. The MGRAS trace shows it: `rd gio_id = 0x00050190`, +`rd [0x00002] = 0`, `rd [0x00003] = 0`, then no more board accesses at all. +IRIX reads the ID as a word, which is why only this probe noticed. + +Fix: `gio_id_lane` in `src/dev/mgras/mod.rs` returns the ID's bytes at their +big-endian lanes for 8- and 16-bit reads at offsets 0-3. Unchecked on real +hardware: whether a High IMPACT answers the narrow reads with the lanes or +with a bus error (the driver accepts either; zero is what breaks it). + +How to reproduce and look: `[machine] profile = "indigo2_ip28"`, banks +`[256, 0, 0, 0]`, `[graphics] board = "highimpact"`, the sgi install69.iso +on `[scsi.4]` with `cdrom = true`, `--ci`; dismiss the failed autoboot, open +the PROM menu's Command Monitor and `boot -f +scsi(0)cdrom(4)rdisk(0)partition(8)/sash64 +scsi(0)cdrom(4)rdisk(0)partition(0)/bsd.rd.IP28`. The kernel's symbols are in +`bsd.rd.IP28` (not stripped): the ISO is an SGI volume header, then a +big-endian UFS1 filesystem at partition 0 (superblock 8 KiB in), so the +kernel is read with a small UFS reader rather than an ISO9660 one. +`mgras trace FILE all` from the boot command on shows the kernel's board +accesses. diff --git a/src/dev/mgras/mgras_tests.rs b/src/dev/mgras/mgras_tests.rs index 9cb9155d0..acd9655bc 100644 --- a/src/dev/mgras/mgras_tests.rs +++ b/src/dev/mgras/mgras_tests.rs @@ -96,6 +96,20 @@ fn fifo_fast_fill_lands_top_down() { m.stop_engines(); } +#[test] +fn narrow_id_reads_return_the_words_own_bytes() { + // OpenBSD's GIO probe takes the ID word only if reads at +2 (16-bit) and + // +3 (8-bit) agree with it. + let m = live_board(); + assert_eq!(read(&m, 32, 0), 0x0005_0190); + assert_eq!(read(&m, 16, 0), 0x0005); + assert_eq!(read(&m, 16, 2), 0x0190); + assert_eq!(read(&m, 8, 1), 0x05); + assert_eq!(read(&m, 8, 2), 0x01); + assert_eq!(read(&m, 8, 3), 0x90); + m.stop_engines(); +} + #[test] fn fifo_and_direct_writes_keep_program_order() { let m = live_board(); diff --git a/src/dev/mgras/mod.rs b/src/dev/mgras/mod.rs index 48cea7e44..48d59aea2 100644 --- a/src/dev/mgras/mod.rs +++ b/src/dev/mgras/mod.rs @@ -98,6 +98,17 @@ const MAP_SIZE: u32 = 0x10_0000; /// GIO ID: product 0x10, 32-bit ID, revision 1, GIO64, no ROM, manufacturer 1. pub const GIO_ID: u32 = 0x0005_0190; +/// A byte or halfword read of the ID word takes its bytes (big-endian), as a +/// GIO probe checks the narrow reads against the word. +fn gio_id_lane(off: u32, bits: u32) -> u64 { + if bits >= 32 { + return GIO_ID as u64; + } + let n = bits / 8; + let at = (off & 3) & !(n - 1); + (GIO_ID >> (8 * (4 - at - n))) as u64 & ((1 << bits) - 1) +} + const HQ_FIFO_DEPTH: usize = 65536; /// Deep enough for most of a frame's texture loads (Quake 3 on High IMPACT /// moves ~13 MB a frame, 1.6 M entries), so the HQ finishes a DMA, and the @@ -220,7 +231,7 @@ impl Front { fn read(&mut self, off: u32, bits: u32) -> u64 { match off { - 0 => GIO_ID as u64, + 0..=3 => gio_id_lane(off, bits), host::UCODE..=0x45FFF => self.hq.ucode[((off - host::UCODE) / 4) as usize] as u64, 0x60000..=0x67FFF => { let t = dcb::Txn::decode(off);