Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Mar 2010 21:41:03 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r206008 - stable/7/sys/sparc64/sparc64
Message-ID:  <201003312141.o2VLf3WR030007@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Wed Mar 31 21:41:03 2010
New Revision: 206008
URL: http://svn.freebsd.org/changeset/base/206008

Log:
  MFC: r204153
  
  Starting with UltraSPARC IV CPUs the CPU caches are described with different
  OFW properties.

Modified:
  stable/7/sys/sparc64/sparc64/cache.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/sparc64/cache.c
==============================================================================
--- stable/7/sys/sparc64/sparc64/cache.c	Wed Mar 31 21:41:00 2010	(r206007)
+++ stable/7/sys/sparc64/sparc64/cache.c	Wed Mar 31 21:41:03 2010	(r206008)
@@ -43,6 +43,7 @@
  */
 /*-
  * Copyright (c) 2001 by Thomas Moestl <tmm@FreeBSD.org>.
+ * Copyright (c) 2008, 2010 Marius Strobl <marius@FreeBSD.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -89,32 +90,49 @@ icache_page_inval_t *icache_page_inval;
 
 #define	OF_GET(h, n, v)	OF_getprop((h), (n), &(v), sizeof(v))
 
+static u_int cache_new_prop(u_int cpu_impl);
+
+static u_int
+cache_new_prop(u_int cpu_impl)
+{
+
+	switch (cpu_impl) {
+	case CPU_IMPL_ULTRASPARCIV:
+	case CPU_IMPL_ULTRASPARCIVp:
+		return (1);
+	default:
+		return (0);
+	}
+}
+
 /*
- * Fill in the cache parameters using the cpu node.
+ * Fill in the cache parameters using the CPU node.
  */
 void
 cache_init(struct pcpu *pcpu)
 {
 	u_long set;
+	u_int use_new_prop;
 
-	if (OF_GET(pcpu->pc_node, "icache-size",
-	    pcpu->pc_cache.ic_size) == -1 ||
-	    OF_GET(pcpu->pc_node, "icache-line-size",
-	    pcpu->pc_cache.ic_linesize) == -1 ||
-	    OF_GET(pcpu->pc_node, "icache-associativity",
-	    pcpu->pc_cache.ic_assoc) == -1 ||
-	    OF_GET(pcpu->pc_node, "dcache-size",
-	    pcpu->pc_cache.dc_size) == -1 ||
-	    OF_GET(pcpu->pc_node, "dcache-line-size",
-	    pcpu->pc_cache.dc_linesize) == -1 ||
-	    OF_GET(pcpu->pc_node, "dcache-associativity",
-	    pcpu->pc_cache.dc_assoc) == -1 ||
-	    OF_GET(pcpu->pc_node, "ecache-size",
-	    pcpu->pc_cache.ec_size) == -1 ||
-	    OF_GET(pcpu->pc_node, "ecache-line-size",
-	    pcpu->pc_cache.ec_linesize) == -1 ||
-	    OF_GET(pcpu->pc_node, "ecache-associativity",
-	    pcpu->pc_cache.ec_assoc) == -1)
+	use_new_prop = cache_new_prop(pcpu->pc_impl);
+	if (OF_GET(pcpu->pc_node, !use_new_prop ? "icache-size" :
+	    "l1-icache-size", pcpu->pc_cache.ic_size) == -1 ||
+	    OF_GET(pcpu->pc_node, !use_new_prop ? "icache-line-size" :
+	    "l1-icache-line-size", pcpu->pc_cache.ic_linesize) == -1 ||
+	    OF_GET(pcpu->pc_node, !use_new_prop ? "icache-associativity" :
+	    "l1-icache-associativity", pcpu->pc_cache.ic_assoc) == -1 ||
+	    OF_GET(pcpu->pc_node, !use_new_prop ? "dcache-size" :
+	    "l1-dcache-size", pcpu->pc_cache.dc_size) == -1 ||
+	    OF_GET(pcpu->pc_node, !use_new_prop ? "dcache-line-size" :
+	    "l1-dcache-line-size", pcpu->pc_cache.dc_linesize) == -1 ||
+	    OF_GET(pcpu->pc_node, !use_new_prop ? "dcache-associativity" :
+	    "l1-dcache-associativity", pcpu->pc_cache.dc_assoc) == -1 ||
+	    OF_GET(pcpu->pc_node, !use_new_prop ? "ecache-size" :
+	    "l2-cache-size", pcpu->pc_cache.ec_size) == -1 ||
+	    OF_GET(pcpu->pc_node, !use_new_prop ? "ecache-line-size" :
+	    "l2-cache-line-size", pcpu->pc_cache.ec_linesize) == -1 ||
+	    OF_GET(pcpu->pc_node, !use_new_prop ? "ecache-associativity" :
+	    "l2-cache-associativity", pcpu->pc_cache.ec_assoc) == -1)
 		panic("cache_init: could not retrieve cache parameters");
 
 	set = pcpu->pc_cache.ic_size / pcpu->pc_cache.ic_assoc;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003312141.o2VLf3WR030007>