Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/arm32 For some classic CPUs, info->[id]cache_se...



details:   https://anonhg.NetBSD.org/src/rev/694872da3eed
branches:  trunk
changeset: 989071:694872da3eed
user:      rin <rin%NetBSD.org@localhost>
date:      Mon Oct 11 07:32:52 2021 +0000

description:
For some classic CPUs, info->[id]cache_sets are not initialized.
Calculate and print numbers of sets in this case.

diffstat:

 sys/arch/arm/arm32/cpu.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (50 lines):

diff -r 2137131daaeb -r 694872da3eed sys/arch/arm/arm32/cpu.c
--- a/sys/arch/arm/arm32/cpu.c  Mon Oct 11 07:31:19 2021 +0000
+++ b/sys/arch/arm/arm32/cpu.c  Mon Oct 11 07:32:52 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.150 2021/10/11 07:19:37 rin Exp $    */
+/*     $NetBSD: cpu.c,v 1.151 2021/10/11 07:32:52 rin Exp $    */
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.150 2021/10/11 07:19:37 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.151 2021/10/11 07:32:52 rin Exp $");
 
 #include <sys/param.h>
 
@@ -612,7 +612,9 @@
                    level + 1,
                    info->dcache_size / 1024,
                    info->dcache_line_size, info->dcache_ways,
-                   info->dcache_sets,
+                   info->dcache_sets ? info->dcache_sets :
+                       info->dcache_size /
+                           (info->dcache_line_size * info->dcache_ways),
                    wtnames[info->cache_type],
                    info->dcache_type & CACHE_TYPE_PIxx ? 'P' : 'V',
                    info->dcache_type & CACHE_TYPE_xxPT ? 'P' : 'V');
@@ -621,14 +623,18 @@
                    level + 1,
                    info->icache_size / 1024,
                    info->icache_line_size, info->icache_ways,
-                   info->icache_sets,
+                   info->icache_sets ? info->icache_sets :
+                       info->icache_size /
+                           (info->icache_line_size * info->icache_ways),
                    info->icache_type & CACHE_TYPE_PIxx ? 'P' : 'V',
                    info->icache_type & CACHE_TYPE_xxPT ? 'P' : 'V');
                aprint_normal_dev(dv, "L%u %dKB/%dB %d-way (%u set) %s %cI%cT Data cache\n",
                    level + 1,
                    info->dcache_size / 1024,
                    info->dcache_line_size, info->dcache_ways,
-                   info->dcache_sets,
+                   info->dcache_sets ? info->dcache_sets :
+                       info->dcache_size /
+                           (info->dcache_line_size * info->dcache_ways),
                    wtnames[info->cache_type],
                    info->dcache_type & CACHE_TYPE_PIxx ? 'P' : 'V',
                    info->dcache_type & CACHE_TYPE_xxPT ? 'P' : 'V');



Home | Main Index | Thread Index | Old Index