NetBSD Problem Report #60205

From www@netbsd.org  Wed Apr 22 16:20:42 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.netbsd.org", Issuer "R12" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 049401A923C
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 22 Apr 2026 16:20:42 +0000 (UTC)
Message-Id: <20260422162041.01B8B1A923F@mollari.NetBSD.org>
Date: Wed, 22 Apr 2026 16:20:41 +0000 (UTC)
From: adrian@freebsd.org
Reply-To: adrian@freebsd.org
To: gnats-bugs@NetBSD.org
Subject: sgimips: indigo 2 doesn't boot due to mach_subtype not being set early enough
X-Send-Pr-Version: www-1.0
X-From4GNATS: "adrian@freebsd.org via gnats" <gnats-admin@NetBSD.org>

>Number:         60205
>Category:       port-sgimips
>Synopsis:       sgimips: indigo 2 doesn't boot due to mach_subtype not being set early enough
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-sgimips-maintainer
>State:          needs-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 22 16:25:01 +0000 2026
>Closed-Date:    
>Last-Modified:  Mon May 04 16:29:46 +0000 2026
>Originator:     Adrian Chadd
>Release:        11.99
>Organization:
>Environment:
>Description:
The Indigo 2 doesn't boot - mach_subtype needs to be set early enough for the PIC/PIT driver (sgimips/dev/int.c) and GIO drivers to know it's running on an Indigo 2, not Indy.

For background, they (Indy, and Indigo 2 R4xxx variants) are both detected as an IP22, so there's a further subtype to know if it's Indigo 2 or Indy.

It's initialised as part of the ioc.c driver initialisation, but that happens /way/ too late in the boot process to be useful.
>How-To-Repeat:
* Boot NetBSD on an Indigo 2
* It'll hang after initialising int0, whilst it's trying to calibrate the timer frequencies

>Fix:
As much as I'd like to make this cleaner, this does work. It mirrors what other early subtype probing is done in the mainbus code.

```
diff --git a/sys/arch/sgimips/sgimips/machdep.c b/sys/arch/sgimips/sgimips/machdep.c
index 89e2ad11f7815..1fe242b70b3e2 100644
--- a/sys/arch/sgimips/sgimips/machdep.c
+++ b/sys/arch/sgimips/sgimips/machdep.c
@@ -377,6 +377,22 @@ mach_init(int argc, int32_t argv32[], uintptr_t magic, int32_t bip32)
 	if (mach_type <= 0)
 		panic("invalid architecture");

+	/*
+	 * Initialise the IP22 Indy/Indigo2 subtype early.
+	 *
+	 * This is needed for various subsystems that require mach_subtype
+	 * to properly initialise.  It's also setup in ioc/ioc.c but
+	 * that's far too late for some peripherals (notably Indigo2 INT2
+	 * timer programming/calibration.)
+	 */
+	if (mach_type == MACH_SGI_IP22) {
+		i = *(volatile u_int32_t *)MIPS_PHYS_TO_KSEG1(0x1fbd9858);
+		if (i & 0x01)
+			mach_subtype = MACH_SGI_IP22_FULLHOUSE; /* Indigo2 */
+		else
+			mach_subtype = MACH_SGI_IP22_GUINNESS; /* Indy */
+	}
+
 	/*
 	 * Get boot device information.
 	 */
```

>Release-Note:

>Audit-Trail:
From: "Adrian Chadd" <adrian@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60205 CVS commit: src/sys/arch/sgimips
Date: Thu, 30 Apr 2026 03:12:40 +0000

 Module Name:	src
 Committed By:	adrian
 Date:		Thu Apr 30 03:12:39 UTC 2026

 Modified Files:
 	src/sys/arch/sgimips/ioc: ioc.c
 	src/sys/arch/sgimips/sgimips: machdep.c

 Log Message:
 sgimips: early initialisation of mach_subtype for SGI Indy / Indigo2

 The mach_subtype field is needed early in boot for dev/int.c (the 8254
 in the IO block) and other bits and pieces like GIO bus config.

 So set it up super early here.

 This allows my Indigo 2 R4400PC-150 to boot - slowly until the int driver
 enumerates, but that's separate problem I'll dig into.

 I also verified my R5000PC-180 Indy boots with this.

 This addresses PR port-sgimips/60205 .


 To generate a diff of this commit:
 cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sgimips/ioc/ioc.c
 cvs rdiff -u -r1.156 -r1.157 src/sys/arch/sgimips/sgimips/machdep.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->needs-pullups
State-Changed-By: adrian@NetBSD.org
State-Changed-When: Mon, 04 May 2026 16:29:46 +0000
State-Changed-Why:
Diff landed; needs pulling up into 11 and 10


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.