[PATCH 04/38] MIPS: SGI-IP27: detect Bedrock hubs at boot
From: Imre Kaloz
Date: Thu Oct 01 2026 - 12:36:04 EST
Read a hub's widget-ID register as the first thing prom_init() does
and record whether it is a Bedrock ASIC, so later code can branch on
that instead of a compile-time select. A local alias read needs no
nasid, so this runs first.
Signed-off-by: Imre Kaloz <kaloz@xxxxxxxxxx>
---
arch/mips/include/asm/sn/addrs.h | 6 ++++++
arch/mips/sgi-ip27/ip27-init.c | 9 +++++++++
2 files changed, 15 insertions(+)
diff --git a/arch/mips/include/asm/sn/addrs.h b/arch/mips/include/asm/sn/addrs.h
index d5c7cfea7761..51161fd5130b 100644
--- a/arch/mips/include/asm/sn/addrs.h
+++ b/arch/mips/include/asm/sn/addrs.h
@@ -35,6 +35,12 @@
#endif /* __ASSEMBLER__ */
+#ifndef __ASSEMBLER__
+
+extern bool system_is_ip35;
+
+#endif /* __ASSEMBLER__ */
+
#define NASID_GET_META(_n) ((_n) >> NASID_LOCAL_BITS)
#ifdef CONFIG_SGI_IP27
diff --git a/arch/mips/sgi-ip27/ip27-init.c b/arch/mips/sgi-ip27/ip27-init.c
index a4daf8ccd16c..6394c2076041 100644
--- a/arch/mips/sgi-ip27/ip27-init.c
+++ b/arch/mips/sgi-ip27/ip27-init.c
@@ -31,6 +31,7 @@
#include <asm/thread_info.h>
#include <asm/sn/launch.h>
#include <asm/sn/mapped_kernel.h>
+#include <asm/xtalk/xwidget.h>
#include "ip27-common.h"
@@ -38,6 +39,7 @@
static DECLARE_BITMAP(hub_init_mask, MAX_NUMNODES);
nasid_t master_nasid = INVALID_NASID;
+bool system_is_ip35;
struct cpuinfo_ip27 sn_cpu_info[NR_CPUS];
EXPORT_SYMBOL_GPL(sn_cpu_info);
@@ -139,8 +141,15 @@ const char *get_system_type(void)
return "SGI Origin";
}
+static inline bool hub_is_bedrock(void)
+{
+ return XWIDGET_PART_NUM(LOCAL_HUB_L(IIO_WID)) == WIDGET_BDRCK_PART_NUM;
+}
+
void __init prom_init(void)
{
+ system_is_ip35 = hub_is_bedrock();
+
prom_init_cmdline(fw_arg0, (LONG *)fw_arg1);
prom_meminit();
}
--
2.47.3