NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-sgimips/60205: sgimips: indigo 2 doesn't boot due to mach_subtype not being set early enough



>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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 22 16:25:01 +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.
 	 */
```




Home | Main Index | Thread Index | Old Index