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 Set up cache line sizes early in th...



details:   https://anonhg.NetBSD.org/src/rev/e2936c98e385
branches:  trunk
changeset: 773272:e2936c98e385
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Jan 30 12:19:45 2012 +0000

description:
Set up cache line sizes early in the MULTIPROCESSOR case (where we already
pass by all the notes anyway), and default them to small-but-working
values in the UP case. Avoids an endless loop when trying to flush
caches before we pass through cpu_attach().

diffstat:

 sys/arch/sparc64/sparc64/autoconf.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (52 lines):

diff -r f6f28883afad -r e2936c98e385 sys/arch/sparc64/sparc64/autoconf.c
--- a/sys/arch/sparc64/sparc64/autoconf.c       Mon Jan 30 10:55:25 2012 +0000
+++ b/sys/arch/sparc64/sparc64/autoconf.c       Mon Jan 30 12:19:45 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.184 2012/01/22 10:32:35 nakayama Exp $ */
+/*     $NetBSD: autoconf.c,v 1.185 2012/01/30 12:19:45 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.184 2012/01/22 10:32:35 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.185 2012/01/30 12:19:45 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -90,6 +90,7 @@
 #include <machine/cpu.h>
 #include <machine/pmap.h>
 #include <machine/bootinfo.h>
+#include <sparc64/sparc64/cache.h>
 #include <sparc64/sparc64/timerreg.h>
 
 #include <dev/ata/atavar.h>
@@ -196,7 +197,7 @@
 get_ncpus(void)
 {
 #ifdef MULTIPROCESSOR
-       int node;
+       int node, l;
        char sbuf[32];
 
        node = findroot();
@@ -208,9 +209,16 @@
                if (strcmp(sbuf, "cpu") != 0)
                        continue;
                sparc_ncpus++;
+               l = prom_getpropint(node, "dcache-line-size", 0);
+               if (l > dcache_line_size)
+                       dcache_line_size = l;
+               l = prom_getpropint(node, "icache-line-size", 0);
+               if (l > icache_line_size)
+                       icache_line_size = l;
        }
 #else
        /* #define sparc_ncpus 1 */
+       icache_line_size = dcache_line_size = 8; /* will be fixed later */
 #endif
 }
 



Home | Main Index | Thread Index | Old Index