Skip to content
Open

405 #950

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ history; author dates can differ after rebases or cherry-picks. Historical
feature names describe the build at the time, not flags to use today. Commit
hashes are given where a change is easiest to understand by reading the commit.

## December 2026

### Machines

- IRIX 4.0.5H boots its miniroot on the Indigo2 with the new `[machine] gio_timeout_aborts = false`, which keeps
GIO bus timeouts from raising bus errors. Indy and Indigo2.

### Storage

- SCSI: a Disconnect after a selection timeout no longer raises a second timeout interrupt; IRIX 4.0.5H reset the
bus and panicked on it. All machines with the WD33C93 (Indy, Indigo2).

## November 2026

### Front ends
Expand Down
1 change: 1 addition & 0 deletions FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ the first `[section]`, because TOML tables continue until the next header.
| `machine.console` | the machine's own | The port that serves `--ci` and `serial_log`: `serial1`, `serial2` (the Onyx2's MediaIO adds `serial3` and `serial4`), or `l1` on the Fuel, Tezro, Origin 3200 and Onyx 3000, which start on it. On the Tezro this selects the host connection only: the PROM uses the L1 until `console ioc4` is run in its Command Monitor and the machine is reset; it then uses the first IOC4 port (`serial1`), and keeps the choice in the `flash` file. |
| `machine.prid` | the part's | The CP0 PRId the guest reads, such as `0x0440` for an R4400 revision 4.0. For trying how a PROM or IRIX treats a revision iris does not ship as a part; the processor itself does not change. Every machine and processor. |
| `machine.clock_multiplier` | `2` | The processor clock over the system clock, as CP0 Config.EC reports it to the guest: 2, 3, 4, 6 or 8 on an R4400; 2 to 8 on an R5000. It changes only what the guest reads, not timing. The R10000 family refuses it: there the board's mode word sets the divisor. |
| `machine.gio_timeout_aborts` | `true` | Indy and Indigo2: `false` stops a GIO bus timeout aborting the read with a bus error, whatever the PROM sets in the memory controller's CPUCTRL1 (which still reads back as written). For IRIX 4.0.5H, which reads an empty graphics slot unprotected; see [docs/indigo2-ip22.md](docs/indigo2-ip22.md#irix-405h). |
| `machine.fpu_prid` | the part's | The FPU's implementation and revision register (FIR, CP1 register 0), as `prid`. |
| `machine.emu_id` | `0` | 0 to 4095; only the Fuel and Tezro take it, and other machines refuse a nonzero one. Mints the machine's system id (`sysinfo -s`, `lmhostid`) in iris's layout. When nonzero it gives the station address `08:00:69:e2:<emu_id>`, which is the Fuel's id. The Tezro's L1 system serial is `LEMU2<emu_id>0`, whose fold is the Tezro's id. 0 is the generic id. See [the Fuel guide](docs/fuel-ip34.md) and [the Tezro guide](docs/tezro-ip53.md). |

Expand Down
1 change: 1 addition & 0 deletions clanker/INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ Running IRIX as a guest: install, network setup, shell quirks, X defaults.

| Note | Kind | Title |
|---|---|---|
| [irix-405h-needs-gio-timeouts-off.md](irix/irix-405h-needs-gio-timeouts-off.md) | rule | IRIX 4.0.5H probes the empty second GR2 slot unprotected and panics on the GIO timeout bus error: `gio_timeout_aborts = false`; the WD33C93 Disconnect-after-timeout fix it also needed |
| [midi-on-a-serial-port.md](irix/midi-on-a-serial-port.md) | howto | Testing MIDI in a guest: `startmidi -p rs232` on RS-232 ports, a minimal libmd sender, checking the synth with `serial` and `IRIS_MIDI_CAPTURE` |
| [b9600-is-a-number-not-a-cflag-bit.md](irix/b9600-is-a-number-not-a-cflag-bit.md) | rule | IRIX 6.5's `B9600` is 9600: OR-ing it into `c_cflag` sets PARENB and HUPCL; use `cfsetospeed` |
| [telnet-lines-are-cut-at-256.md](irix/telnet-lines-are-cut-at-256.md) | rule | A command line sent over telnet is cut at 256 characters (tty canonical mode): keep `irix-sh.py run` commands short or push a script; some images' xdm grabs the server until a console login |
Expand Down
51 changes: 51 additions & 0 deletions clanker/irix/irix-405h-needs-gio-timeouts-off.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# IRIX 4.0.5H on the Indigo2 needs GIO timeout aborts off

Status: 2026-12-01, miniroot boots to the installer (unix.IP22 from the swap
partition via `boot -f dksc(0,4,8)sashARCS`, `boot -f dksc(0,1,1)unix.IP22`).

## Symptom

The kernel loads (`entry: 0x88002000`) and prints nothing. Stopped later, the
CPU spins at 0x80000180 on data words: the vectors and early kernel text are
covered by a stack that recursed through low memory.

## Cause

- Early console setup walks a static two-entry GR2 board table (kernel data
at 0x8810e884: 0xbf000000, then 0xbf400000) and reads `hq.mystery`
(+0x6a07c) of each with a plain `lw`, with no bus-error protection
(observed in the shipped kernel's disassembly).
- The second slot is empty. Both the 5.1 Rev B and 5.3 Rev E PROMs leave
CPUCTRL1.ABORT_EN set (0x16 at kernel entry); the kernel keeps bit 4 in its
own read-modify-write (`& ~0xf | 0xd`). The MC aborts the read: DBE.
- The bus-error path saves the MC error registers, decodes GIO_ERROR_STAT and
panics; nothing in it recovers a probe.
The panic message goes to the textport console whose board init was cut
short: null pointer, TLB miss, recursion.
- Why a real Indigo2 does not fault here is not known.

## Fix

`[machine] gio_timeout_aborts = false` (MC records the timeout, never aborts;
CPUCTRL1 reads back as written). See docs/indigo2-ip22.md.

## Next problem it uncovered (fixed 0c71383ae)

After a selection timeout on an absent target, the PROM and 4.0.5 both issue
WD33C93 Disconnect (04). The model ran every non-select command through the
absent-target check and answered with a second 0x42 interrupt; 4.0.5 printed
"Spurious scsi interrupt, no connected channel", reset the bus and faulted.
Disconnect while disconnected must give no interrupt and must not set LCI:
the PROM's command routine retries forever while LCI is set, even though the
datasheet says Level I commands in an invalid state are ignored.

## Gotchas

- coffdump (src/coffdump.rs, builds alone with `rustc`) writes `<file>.map`
for ECOFF kernels; llvm-nm cannot read them. The map has globals only, so
static functions show as `nearby_global+0x...`.
- The installed R4400 patch (ignore/ip22_405/patch) only replaces scsi.o
(a timing race that ends in bus resets); the miniroot kernel is unpatched.
- 4.0.5H is not Y2K safe: the date shows 1920.
- gxemul forks (tenox7, rpajarola) only run 4.0.5 on the IP6 (4D/20); their
WD33C93 Disconnect also raises no interrupt.
18 changes: 18 additions & 0 deletions docs/indigo2-ip22.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,24 @@ byte-order bits do to its DMA, and which board a CPU-control graphics reset reac
For the R10000 Indigo2 profile and larger RAM banks, see
[Indigo2 IP28](indigo2-ip28.md). IP28 has its own built-in PROM.

## IRIX 4.0.5H

IRIX 4.0.5H, the first release for the Indigo2, boots its miniroot with this in
the machine's file:

```toml
[machine]
profile = "indigo2_ip22"
gio_timeout_aborts = false
```

Its graphics probe reads the second graphics slot (`0x1F400000`) whether or not
a board is there, with no protection against a bus error. The PROM (5.1 Rev B
and 5.3 Rev E alike) enables GIO bus time-outs, so the empty slot answers with
a bus error and 4.0.5H panics before it prints anything. The key keeps GIO
time-outs from aborting the read. 4.0.5H also predates the year 2000: it shows
the date in 1920.

## Remaining gaps

- Full EXTIO bus-error and EISA interrupt paths
Expand Down
11 changes: 11 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1463,6 +1463,11 @@ pub struct MachineSection {
/// divisor from the board's mode word and refuses the key.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub clock_multiplier: Option<u8>,
/// Quirk for the Indy, Indigo2 and IP28 memory controller: `false` keeps a GIO bus timeout
/// from aborting the read with a bus error, whatever the PROM writes to CPUCTRL1.ABORT_EN.
/// IRIX 4.0.5H reads the second graphics slot unprotected and panics on the bus error.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub gio_timeout_aborts: Option<bool>,

// The keys below are how a file spells what a machine has beyond the
// shared keys. In memory they live in the machine's own section
Expand Down Expand Up @@ -3578,6 +3583,12 @@ impl MachineConfig {
self.cpu_part()?;
self.machine.profile.accepts_cpus(self.machine.cpus())?;
self.clock_ec()?;
if self.machine.gio_timeout_aborts.is_some()
&& !matches!(self.machine.profile, MachineProfile::IndyIp24 | MachineProfile::Indigo2Ip22 | MachineProfile::Indigo2Ip28)
{
return Err(format!("[machine] gio_timeout_aborts: only the Indy and Indigo2 have the memory controller it changes, not {}",
self.machine.profile.label()));
}
crate::dev::serial_dev::validate(self)?;
let board = self.graphics_board();
let p = self.machine.profile;
Expand Down
23 changes: 22 additions & 1 deletion src/dev/mc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ pub struct MemoryController {
/// is per-controller, not per-transfer — uncontended in practice, since
/// only that one thread runs transfers.
vdma_stage: Arc<Mutex<Box<[u64]>>>,
/// Cleared by the `gio_timeout_aborts = false` quirk: a GIO timeout is then
/// recorded but never aborts, whatever CPUCTRL1.ABORT_EN says.
gio_aborts: Arc<AtomicBool>,
}

impl MemoryController {
Expand Down Expand Up @@ -159,6 +162,7 @@ impl MemoryController {
event_tx: Arc::new(OnceLock::new()),
vdma_stage: Arc::new(Mutex::new(
vec![0u64; crate::dev::mc_vdma::VDMA_CHUNK_QWORDS].into_boxed_slice())),
gio_aborts: Arc::new(AtomicBool::new(true)),
}
}

Expand Down Expand Up @@ -527,11 +531,18 @@ impl MemoryController {

/// A GIO access nobody answered. Returns whether the MC aborts it with a
/// bus error (`CPUCTRL1.ABORT_EN`, which the PROM sets at power-on).
/// The `gio_timeout_aborts` quirk: `false` stops GIO timeouts aborting reads.
/// CPUCTRL1 still reads back as written.
pub fn set_gio_timeout_aborts(&self, on: bool) {
self.gio_aborts.store(on, Ordering::Relaxed);
}

pub fn report_gio_timeout(&self, addr: u64) -> bool {
let mut state = self.state.lock();
state.regs[(REG_GIO_ERROR_ADDR / 4) as usize] = addr as u32;
// TIME bit (10) only set when ABORT_EN (CPUCTRL1 bit 4) is enabled
let abort_en = (state.regs[(REG_CPUCTRL1 / 4) as usize] & (1 << 4)) != 0;
let abort_en = (state.regs[(REG_CPUCTRL1 / 4) as usize] & (1 << 4)) != 0
&& self.gio_aborts.load(Ordering::Relaxed);
if abort_en {
state.regs[(REG_GIO_ERROR_STAT / 4) as usize] = 1u32 << 10; // TIME: GIO bus timeout
}
Expand Down Expand Up @@ -1383,6 +1394,16 @@ mod tests {
assert_eq!(gio_arb & 0x400, 0, "fullhouse dual GIO — ONE_GIO clear");
}

#[test]
fn the_quirk_keeps_gio_timeouts_from_aborting() {
let mc = MemoryController::new(Arc::new(Mutex::new(Eeprom93c56::new())), false, [0u32; 4]);
mc.write32((MC_BASE + REG_CPUCTRL1) as u64, 0x16);
assert!(mc.report_gio_timeout(0x1f46_a07c), "ABORT_EN aborts a timed-out read");
mc.set_gio_timeout_aborts(false);
assert!(!mc.report_gio_timeout(0x1f46_a07c), "the quirk keeps the read from aborting");
assert_eq!(mc.read32((MC_BASE + REG_CPUCTRL1) as u64).data, 0x16, "CPUCTRL1 reads back as written");
}

#[test]
fn test_mc_internal_access() {
let eeprom = Arc::new(Mutex::new(Eeprom93c56::new()));
Expand Down
16 changes: 15 additions & 1 deletion src/dev/wd33c93a.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,11 @@ impl Wd33c93aState {
return;
}

if !self.bus.has_target(self.target_id as u8) {
// Only a selection can time out. Other commands do not address a
// target: IRIX 4.0.5 follows a selection timeout with Disconnect,
// which must not look like a second selection of the absent target.
let selects = matches!(cmd, cmd::SELECT_ATN | cmd::SELECT_ATN_XFER | cmd::SELECT | cmd::SELECT_XFER);
if selects && !self.bus.has_target(self.target_id as u8) {
dlog!(self.log_module(), "WD33C93A({}): No device at target {}, timing out", self.id, self.target_id);
dlog_dev!(self.log_module(), "SEL_TIMEO tgt={} cmd={:02x} asr={:02x}", self.target_id, cmd, self.asr);
// First interrupt (0x42): consumed by selectbus's SBIC_WAIT(INT) poll.
Expand All @@ -1211,6 +1215,16 @@ impl Wd33c93aState {
cmd::ASSERT_ATN => {
self.update_asr(asr::CIP, 0);
}
// Disconnect after a selection timeout (the PROM and IRIX 4.0.5 both
// issue one to release the bus): the chip is already disconnected,
// so the bus is released with no further interrupt. The PROM
// retries a command for as long as LCI is set, so it is not set.
cmd::DISCONNECT
if self.regs[regs::COMMAND_PHASE as usize] == command_phase::DISCONNECTED
&& self.irq_fifo.is_empty() =>
{
self.update_asr(asr::CIP | asr::BSY, 0);
}
cmd::DISCONNECT => {
self.queue_interrupt(Some(command_phase::DISCONNECTED), scsi_status::DISCONNECT);
self.update_asr(asr::BSY, 0);
Expand Down
1 change: 1 addition & 0 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ impl Machine {
let mc_banks: [u32; 4] = cfg.banks[..4].try_into().expect("the MC has four banks");
let mc = MemoryController::new_for_profile(
eeprom_mc.clone(), guinness, mc_banks, cfg.machine.profile.ip28(), timer_manager.clock().clone());
if let Some(on) = cfg.machine.gio_timeout_aborts { mc.set_gio_timeout_aborts(on); }
// IP28: IRIX takes the CPU speed from the PROM's `cpufreq` (194, i.e.
// a 195 MHz R10000) instead of measuring it, and times with it: UST
// assumes Count at half that, and the RPSS cycle counter the MC clock
Expand Down