Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/sparc64 sun4v: Ensure that sane values are ...
details: https://anonhg.NetBSD.org/src/rev/53532a4b206b
branches: trunk
changeset: 336080:53532a4b206b
user: palle <palle%NetBSD.org@localhost>
date: Wed Feb 11 04:44:11 2015 +0000
description:
sun4v: Ensure that sane values are returned in scenarios where no x_cache_associativity info is present, e.g. in a simulated environment like the Legion simulator
diffstat:
sys/arch/sparc64/sparc64/cpu.c | 34 +++++++++++++++++++++++-----------
1 files changed, 23 insertions(+), 11 deletions(-)
diffs (69 lines):
diff -r fdadbb088d7b -r 53532a4b206b sys/arch/sparc64/sparc64/cpu.c
--- a/sys/arch/sparc64/sparc64/cpu.c Wed Feb 11 00:37:25 2015 +0000
+++ b/sys/arch/sparc64/sparc64/cpu.c Wed Feb 11 04:44:11 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.122 2015/01/24 20:17:22 palle Exp $ */
+/* $NetBSD: cpu.c,v 1.123 2015/02/11 04:44:11 palle Exp $ */
/*
* Copyright (c) 1996
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.122 2015/01/24 20:17:22 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.123 2015/02/11 04:44:11 palle Exp $");
#include "opt_multiprocessor.h"
@@ -210,9 +210,13 @@
static int
cpu_icache_associativity(int node)
{
- if (CPU_ISSUN4V)
- return cpu_cache_info_sun4v("instn", 1, "associativity");
- else
+ if (CPU_ISSUN4V) {
+ int val;
+ val = cpu_cache_info_sun4v("instn", 1, "associativity");
+ if (val == 0)
+ val = 1;
+ return val;
+ } else
return prom_getpropint(node, "icache-associativity", 1);
}
@@ -246,9 +250,13 @@
static int
cpu_dcache_associativity(int node)
{
- if (CPU_ISSUN4V)
- return cpu_cache_info_sun4v("data", 1, "associativity");
- else
+ if (CPU_ISSUN4V) {
+ int val;
+ val = cpu_cache_info_sun4v("data", 1, "associativity");
+ if (val == 0)
+ val = 1;
+ return val;
+ } else
return prom_getpropint(node, "dcache-associativity", 1);
}
@@ -282,9 +290,13 @@
static int
cpu_ecache_associativity(int node)
{
- if (CPU_ISSUN4V)
- return cpu_cache_info_sun4v(NULL, 2, "associativity");
- else
+ if (CPU_ISSUN4V) {
+ int val;
+ val = cpu_cache_info_sun4v(NULL, 2, "associativity");
+ if (val == 0)
+ val = 1;
+ return val;
+ } else
return prom_getpropint(node, "ecache-associativity", 1);
}
Home |
Main Index |
Thread Index |
Old Index