Subject: port-sparc64/12844: kernel prints wrong cache sizes for Ultra 1 /w OBP 3.11
To: None <gnats-bugs@gnats.netbsd.org>
From: None <Thilo.Manske@HEH.Uni-Oldenburg.DE>
List: netbsd-bugs
Date: 05/06/2001 00:28:18
>Number: 12844
>Category: port-sparc64
>Synopsis: kernel prints wrong cache sizes for Ultra 1 /w OBP 3.11
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: port-sparc64-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat May 05 15:28:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Thilo Manske
>Release: -current Sat May 5 2001
>Organization:
>Environment:
NetBSD 1.5V (Ulla) #13: Sat May 5 23:33:53 MEST 2001 thilo@Ulla:/usr/src/sys/arch/sparc64/compile/Ulla
System: Sun Ultra 1 Creator
Architecture: sparc64
Machine: sparc64
>Description:
The openprom of my Ultra 1 Creator says this about the CPU node:
manufacturer# 00 00 00 17
implementation# 00 00 00 10
mask# 00 00 00 22
sparc-version 00 00 00 09
ecache-associativity 00 00 00 01
ecache-line-size 00 00 00 40
ecache-size 00 08 00 00
#dtlb-entries 00 00 00 40
dcache-associativity 00 00 00 01
dcache-line-size 00 00 00 20
dcache-size 00 00 40 00
#itlb-entries 00 00 00 40
icache-associativity 00 00 00 02
icache-line-size 00 00 00 20
icache-size 00 00 40 00
upa-portid 00000000
clock-frequency 09f46d95
reg 000001c0 00000000 00000000 00000008
device_type cpu
name SUNW,UltraSPARC
(The PROM is OBP 3.11.1 1997/12/03 15:44)
But NetBSD shows this:
cpu0 at mainbus0: SUNW,UltraSPARC @ 167.015 MHz, version 0 FPU
cpu0: physical 4K instruction (32 b/l), 4K data (32 b/l), 2048K external (64 b/l)
(It should be 16K/16K instruction/data and 512k external cache).
>How-To-Repeat:
>Fix:
Here's one way to patch it:
--- cpu.c.old Tue Apr 24 15:43:00 2001
+++ cpu.c Sat May 5 23:33:43 2001
@@ -290,9 +290,10 @@
if ((1 << i) != l && l)
panic("bad icache line size %d", l);
cacheinfo.ic_l2linesize = i;
- cacheinfo.ic_totalsize = l *
- getpropint(node, "icache-nlines", 64) *
- getpropint(node, "icache-associativity", 1);
+ if (!(cacheinfo.ic_totalsize=getpropint(node, "icache-size",0)))
+ cacheinfo.ic_totalsize = l *
+ getpropint(node, "icache-nlines", 64) *
+ getpropint(node, "icache-associativity", 1);
cacheinfo.dc_linesize = l =
getpropint(node, "dcache-line-size",0);
@@ -301,9 +302,10 @@
if ((1 << i) != l && l)
panic("bad dcache line size %d", l);
cacheinfo.dc_l2linesize = i;
- cacheinfo.dc_totalsize = l *
- getpropint(node, "dcache-nlines", 128) *
- getpropint(node, "dcache-associativity", 1);
+ if (!(cacheinfo.dc_totalsize=getpropint(node, "dcache-size",0)))
+ cacheinfo.dc_totalsize = l *
+ getpropint(node, "dcache-nlines", 128) *
+ getpropint(node, "dcache-associativity", 1);
cacheinfo.ec_linesize = l =
getpropint(node, "ecache-line-size", 0);
@@ -312,9 +314,10 @@
if ((1 << i) != l && l)
panic("bad ecache line size %d", l);
cacheinfo.ec_l2linesize = i;
- cacheinfo.ec_totalsize = l *
- getpropint(node, "ecache-nlines", 32768) *
- getpropint(node, "ecache-associativity", 1);
+ if (!(cacheinfo.ec_totalsize=getpropint(node, "ecache-size",0)))
+ cacheinfo.ec_totalsize = l *
+ getpropint(node, "ecache-nlines", 32768) *
+ getpropint(node, "ecache-associativity", 1);
/*
* XXX - The following will have to do until
>Release-Note:
>Audit-Trail:
>Unformatted: