summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-02-28 18:01:40 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-02-28 18:01:40 +0000
commita400e25c8cf33c9ef3152f9f149cc64f0f5d6345 (patch)
tree4213df00ad0726a5874ce82bc16b6d60d3330955 /sys
parentc39dad21772231248d51b926b12bdf67f413ff3e (diff)
Pass L2 cache size in struct cpu_hwinfo, so that bootstrap of secondary
processors can display correct data. Now cpu1 on octane is correctly reported in dmesg.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mips64/include/cpu.h3
-rw-r--r--sys/arch/mips64/mips64/cpu.c19
-rw-r--r--sys/arch/sgi/sgi/ip30_machdep.c4
3 files changed, 23 insertions, 3 deletions
diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h
index 634b772aa98..746fa74aa71 100644
--- a/sys/arch/mips64/include/cpu.h
+++ b/sys/arch/mips64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.56 2010/02/28 17:23:23 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.57 2010/02/28 18:01:36 miod Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -369,6 +369,7 @@ struct cpu_hwinfo {
uint32_t clock; /* Hz */
uint32_t tlbsize;
uint type;
+ uint32_t l2size;
};
struct cpu_info {
diff --git a/sys/arch/mips64/mips64/cpu.c b/sys/arch/mips64/mips64/cpu.c
index cb24078eff9..dc9f2512fd5 100644
--- a/sys/arch/mips64/mips64/cpu.c
+++ b/sys/arch/mips64/mips64/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.26 2010/02/02 01:29:56 syuu Exp $ */
+/* $OpenBSD: cpu.c,v 1.27 2010/02/28 18:01:39 miod Exp $ */
/*
* Copyright (c) 1997-2004 Opsycon AB (www.opsycon.se)
@@ -109,6 +109,23 @@ cpuattach(struct device *parent, struct device *dev, void *aux)
ci->ci_cpuid = cpuno;
ci->ci_dev = dev;
bcopy(ch, &ci->ci_hw, sizeof(struct cpu_hwinfo));
+#ifdef MULTIPROCESSOR
+ /*
+ * When attaching secondary processors, cache information is not
+ * available yet. But since the MP-capable systems we run on
+ * currently all have R10k-style caches, we can quickly compute
+ * the needed values.
+ */
+ if (!ISSET(ci->ci_flags, CPUF_PRIMARY)) {
+ ci->ci_cacheways = 2;
+ ci->ci_l1instcachesize = 32 * 1024;
+ ci->ci_l1instcacheline = 64;
+ ci->ci_l1datacachesize = 32 * 1024;
+ ci->ci_l1datacacheline = 64;
+ ci->ci_l2size = ch->l2size;
+ ci->ci_l3size = 0;
+ }
+#endif
printf(": ");
diff --git a/sys/arch/sgi/sgi/ip30_machdep.c b/sys/arch/sgi/sgi/ip30_machdep.c
index 0ef26740e65..75cb72af464 100644
--- a/sys/arch/sgi/sgi/ip30_machdep.c
+++ b/sys/arch/sgi/sgi/ip30_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip30_machdep.c,v 1.35 2010/01/19 19:54:24 miod Exp $ */
+/* $OpenBSD: ip30_machdep.c,v 1.36 2010/02/28 18:01:39 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -245,6 +245,8 @@ ip30_autoconf(struct device *parent)
hw.c0prid =
*(volatile uint32_t *)(mpconf + MPCONF_PRID(cpuid));
hw.type = (hw.c0prid >> 8) & 0xff;
+ hw.l2size = 1 << *(volatile uint32_t *)
+ (mpconf + MPCONF_SCACHESZ(cpuid));
caa.caa_hw = &hw;
config_found(parent, &caa, mbprint);
}