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: Fixed bug in cpu_cache_info_...



details:   https://anonhg.NetBSD.org/src/rev/6369a172820e
branches:  trunk
changeset: 806974:6369a172820e
user:      palle <palle%NetBSD.org@localhost>
date:      Sun Mar 22 19:37:54 2015 +0000

description:
sun4v: Fixed bug in cpu_cache_info_sun4v() causing non-cache nodes to be processed - this should fix crashes on T2-based systems (e.g. T5120) when retrieving L2$ info during bootstrap. Tested by 
rodent@

diffstat:

 sys/arch/sparc64/sparc64/cpu.c |  31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diffs (52 lines):

diff -r c4aace60cb8e -r 6369a172820e sys/arch/sparc64/sparc64/cpu.c
--- a/sys/arch/sparc64/sparc64/cpu.c    Sun Mar 22 19:33:21 2015 +0000
+++ b/sys/arch/sparc64/sparc64/cpu.c    Sun Mar 22 19:37:54 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.123 2015/02/11 04:44:11 palle Exp $ */
+/*     $NetBSD: cpu.c,v 1.124 2015/03/22 19:37:54 palle Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.123 2015/02/11 04:44:11 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.124 2015/03/22 19:37:54 palle Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -161,18 +161,21 @@
        uint64_t val = 0;;
        idx = mdesc_find_node_by_idx(idx, "cache");
        while (idx != -1 && val == 0) {
-               const char *p;
-               size_t len = 0;
-               p = mdesc_get_prop_data(idx, "type", &len);
-               if (p == NULL)
-                       panic("No type found\n");
-               if (len == 0)
-                       panic("Len is zero");
-               if (type == NULL || strcmp(p, type) == 0) {
-                       uint64_t l;
-                       l = mdesc_get_prop_val(idx, "level");
-                       if (l == level)
-                               val = mdesc_get_prop_val(idx, prop);
+               const char *name = mdesc_name_by_idx(idx);
+               if (strcmp("cache", name) == 0) {
+                       const char *p;
+                       size_t len = 0;
+                       p = mdesc_get_prop_data(idx, "type", &len);
+                       if (p == NULL)
+                               panic("No type found\n");
+                       if (len == 0)
+                               panic("Len is zero");
+                       if (type == NULL || strcmp(p, type) == 0) {
+                               uint64_t l;
+                               l = mdesc_get_prop_val(idx, "level");
+                               if (l == level)
+                                       val = mdesc_get_prop_val(idx, prop);
+                       }
                }
                if (val == 0)
                        idx = mdesc_next_node(idx);



Home | Main Index | Thread Index | Old Index